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

Skip to content

Commit d16eda9

Browse files
committed
fixed plan's custom_scan_tlist according to PostgreSQL 3fc6e2d7f5
1 parent 01f39d4 commit d16eda9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

init.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "optimizer/paths.h"
33
#include "optimizer/pathnode.h"
44
#include "optimizer/restrictinfo.h"
5+
#include "optimizer/tlist.h"
56
#include "utils/tqual.h"
67
#include "utils/builtins.h"
78
#include "utils/elog.h"
@@ -449,7 +450,7 @@ create_crossmatch_plan(PlannerInfo *root,
449450
cscan->scan.plan.targetlist = tlist;
450451
cscan->scan.plan.qual = joinclauses;
451452
cscan->scan.scanrelid = 0;
452-
cscan->custom_scan_tlist = tlist; /* tlist of the 'virtual' join rel
453+
cscan->custom_scan_tlist = make_tlist_from_pathtarget(&rel->reltarget); /* tlist of the 'virtual' join rel
453454
we'll have to build and scan */
454455

455456
cscan->flags = best_path->flags;
@@ -512,8 +513,8 @@ crossmatch_begin(CustomScanState *node, EState *estate, int eflags)
512513
scan_state->outer = heap_open(scan_state->outer_rel, AccessShareLock);
513514
scan_state->inner = heap_open(scan_state->inner_rel, AccessShareLock);
514515

515-
scan_state->values = palloc(sizeof(Datum) * nlist);
516-
scan_state->nulls = palloc(sizeof(bool) * nlist);
516+
scan_state->values = palloc0(sizeof(Datum) * nlist);
517+
scan_state->nulls = palloc0(sizeof(bool) * nlist);
517518

518519
/* Store blank tuple in case scan tlist is empty */
519520
if (scan_state->scan_tlist == NIL)
@@ -575,6 +576,7 @@ crossmatch_exec(CustomScanState *node)
575576
if (!htup_outer_ready)
576577
{
577578
htup_outer_ready = true;
579+
/* TODO: check result */
578580
heap_fetch(scan_state->outer, SnapshotSelf,
579581
&htup_outer, &buf1, false, NULL);
580582
}
@@ -665,6 +667,7 @@ static void
665667
crossmatch_rescan(CustomScanState *node)
666668
{
667669
/* NOTE: nothing to do here? */
670+
node->ss.ps.ps_TupFromTlist = false;
668671
}
669672

670673
static void

0 commit comments

Comments
 (0)