Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f56c12c

Browse files
committed
add index names to explain output
1 parent 19da69a commit f56c12c

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

init.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ crossmatch_create_scan_state(CustomScan *node)
434434
static void
435435
crossmatch_begin(CustomScanState *node, EState *estate, int eflags)
436436
{
437-
CrossmatchScanState *scan_state = (CrossmatchScanState *) node;
438-
CrossmatchContext *ctx = (CrossmatchContext *) palloc0(sizeof(CrossmatchContext));
437+
CrossmatchScanState *scan_state = (CrossmatchScanState *) node;
438+
CrossmatchContext *ctx = (CrossmatchContext *) palloc0(sizeof(CrossmatchContext));
439439

440440
scan_state->ctx = ctx;
441441
setupFirstcall(ctx, scan_state->outer_idx,
@@ -448,10 +448,10 @@ crossmatch_begin(CustomScanState *node, EState *estate, int eflags)
448448
static TupleTableSlot *
449449
crossmatch_exec(CustomScanState *node)
450450
{
451-
CrossmatchScanState *scan_state = (CrossmatchScanState *) node;
452-
TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
453-
TupleDesc tupdesc = node->ss.ss_ScanTupleSlot->tts_tupleDescriptor;
454-
HeapTuple htup = scan_state->stored_tuple;
451+
CrossmatchScanState *scan_state = (CrossmatchScanState *) node;
452+
TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
453+
TupleDesc tupdesc = node->ss.ss_ScanTupleSlot->tts_tupleDescriptor;
454+
HeapTuple htup = scan_state->stored_tuple;
455455

456456
TupleTableSlot *result;
457457

@@ -534,7 +534,20 @@ crossmatch_rescan(CustomScanState *node)
534534
static void
535535
crossmatch_explain(CustomScanState *node, List *ancestors, ExplainState *es)
536536
{
537+
CrossmatchScanState *scan_state = (CrossmatchScanState *) node;
538+
StringInfoData str;
539+
540+
initStringInfo(&str);
537541

542+
appendStringInfo(&str, "%s",
543+
get_rel_name(scan_state->outer_idx));
544+
ExplainPropertyText("Outer index", str.data, es);
545+
546+
resetStringInfo(&str);
547+
548+
appendStringInfo(&str, "%s",
549+
get_rel_name(scan_state->inner_idx));
550+
ExplainPropertyText("Inner index", str.data, es);
538551
}
539552

540553
void
@@ -559,4 +572,4 @@ _PG_init(void)
559572
crossmatch_exec_methods.MarkPosCustomScan = NULL;
560573
crossmatch_exec_methods.RestrPosCustomScan = NULL;
561574
crossmatch_exec_methods.ExplainCustomScan = crossmatch_explain;
562-
}
575+
}

0 commit comments

Comments
 (0)