agora inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 5/7] fix
70+ messages / 4 participants
[nested] [flat]

* [PATCH 5/7] fix
@ 2020-03-19 01:54  Tomas Vondra <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Tomas Vondra @ 2020-03-19 01:54 UTC (permalink / raw)

---
 .../postgres_fdw/expected/postgres_fdw.out    |  4 ++--
 src/backend/executor/execExpr.c               |  5 +++--
 src/backend/executor/nodeAgg.c                | 20 +++++++++----------
 src/backend/optimizer/util/pathnode.c         |  4 ++--
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index 62c2697920..fc0ed2f4d5 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -3448,8 +3448,8 @@ select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls la
    Sort Key: ft1.c2
    ->  MixedAggregate
          Output: c2, sum(c1)
-         Hash Key: ft1.c2
          Group Key: ()
+         Hash Key: ft1.c2
          ->  Foreign Scan on public.ft1
                Output: c2, c1
                Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3))
@@ -3473,8 +3473,8 @@ select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last
    Sort Key: ft1.c2
    ->  MixedAggregate
          Output: c2, sum(c1)
-         Hash Key: ft1.c2
          Group Key: ()
+         Hash Key: ft1.c2
          ->  Foreign Scan on public.ft1
                Output: c2, c1
                Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3))
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 07789501f7..669843faf5 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -2937,7 +2937,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, bool nullcheck)
 	PlanState  *parent = &aggstate->ss.ps;
 	ExprEvalStep scratch = {0};
 	bool		isCombine = DO_AGGSPLIT_COMBINE(aggstate->aggsplit);
-	ListCell	*lc;
+	ListCell   *lc;
 	LastAttnumInfo deform = {0, 0, 0};
 
 	state->expr = (Expr *) aggstate;
@@ -2978,6 +2978,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, bool nullcheck)
 		NullableDatum *strictargs = NULL;
 		bool	   *strictnulls = NULL;
 		int			argno;
+		int			setno;
 		ListCell   *bail;
 
 		/*
@@ -3155,7 +3156,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, bool nullcheck)
 		 * grouping set). Do so for both sort and hash based computations, as
 		 * applicable.
 		 */
-		for (int setno = 0; setno < phase->numsets; setno++)
+		for (setno = 0; setno < phase->numsets; setno++)
 		{
 			ExecBuildAggTransCall(state, aggstate, &scratch, trans_fcinfo,
 								  pertrans, transno, setno, phase, nullcheck);
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 20c5eb98b3..38d0bd5895 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -333,7 +333,7 @@ initialize_phase(AggState *aggstate, int newphase)
 	AggStatePerPhaseSort persort;
 
 	Assert(newphase == 0 || newphase == aggstate->current_phase + 1);
-	
+
 	/* Don't use aggstate->phase here, it might not be initialized yet*/
 	current_phase = aggstate->phases[aggstate->current_phase];
 
@@ -1516,7 +1516,7 @@ hash_agg_entry_size(int numAggs, Size tupleWidth, Size transitionSpace)
  * When called, CurrentMemoryContext should be the per-query context. The
  * already-calculated hash value for the tuple must be specified.
  */
-static void 
+static void
 lookup_hash_entry(AggState *aggstate, AggStatePerPhaseHash perhash, uint32 hash)
 {
 	TupleTableSlot *hashslot = perhash->hashslot;
@@ -1724,7 +1724,7 @@ agg_retrieve_direct(AggState *aggstate)
 					numGroupingSets = aggstate->phase->numsets;
 					node = aggstate->phase->aggnode;
 					numReset = numGroupingSets;
-					pergroups = aggstate->phase->pergroups; 
+					pergroups = aggstate->phase->pergroups;
 				}
 				else
 				{
@@ -2123,7 +2123,7 @@ agg_retrieve_hash_table(AggState *aggstate)
 				 */
 				select_current_set(aggstate, 0, true);
 				initialize_phase(aggstate, aggstate->current_phase + 1);
-				perhash = (AggStatePerPhaseHash) aggstate->phase;	
+				perhash = (AggStatePerPhaseHash) aggstate->phase;
 				ResetTupleHashIterator(perhash->hashtable, &perhash->hashiter);
 
 				continue;
@@ -2269,7 +2269,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 
 	aggstate->maxsets = numGroupingSets;
 	aggstate->numphases = 1 + list_length(node->chain);
-	
+
 	/*
 	 * The first phase is not sorted, agg need to do its own sort. See
 	 * agg_sort_input(), this can only happen in groupingsets case.
@@ -2390,7 +2390,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 	numaggs = aggstate->numaggs;
 	Assert(numaggs == list_length(aggstate->aggs));
 
-	/* 
+	/*
 	 * For each phase, prepare grouping set data and fmgr lookup data for
 	 * compare functions.  Accumulate all_grouped_cols in passing.
 	 */
@@ -2430,7 +2430,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 
 			all_grouped_cols = bms_add_members(all_grouped_cols, cols);
 
-			/* 
+			/*
 			 * Initialize pergroup state. For AGG_HASHED, all groups do transition
 			 * on the fly, all pergroup states are kept in hashtable, everytime
 			 * a tuple is processed, lookup_hash_entry() choose one group and
@@ -2499,7 +2499,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 				phasedata->grouped_cols = NULL;
 			}
 
-			/* 
+			/*
 			 * Initialize pergroup states for AGG_SORTED/AGG_PLAIN/AGG_MIXED
 			 * phases, each set only have one group on the fly, all groups in
 			 * a set can reuse a pergroup state. Unlike AGG_HASHED, we
@@ -3610,8 +3610,8 @@ ExecReScanAgg(AggState *node)
 					   sizeof(AggStatePerGroupData) * node->numaggs);
 		}
 
-		/* 
-		 * the agg did its own first sort using tuplesort and the first
+		/*
+		 * The agg did its own first sort using tuplesort and the first
 		 * tuplesort is kept (see initialize_phase), if the subplan does
 		 * not have any parameter changes, and none of our own parameter
 		 * changes affect input expressions of the aggregated functions,
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 2dfa3fa17e..ff8f676dfb 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -2983,7 +2983,7 @@ create_agg_path(PlannerInfo *root,
  * 'rollups' is a list of RollupData nodes
  * 'agg_costs' contains cost info about the aggregate functions to be computed
  * 'numGroups' is the estimated total number of groups
- * 'is_sorted' is the input sorted in the group cols of first rollup 
+ * 'is_sorted' is the input sorted in the group cols of first rollup
  */
 GroupingSetsPath *
 create_groupingsets_path(PlannerInfo *root,
@@ -3098,7 +3098,7 @@ create_groupingsets_path(PlannerInfo *root,
 			AggStrategy	rollup_strategy;
 			Path	sort_path;	/* dummy for result of cost_sort */
 			Path	agg_path;	/* dummy for result of cost_agg */
-			
+
 			sort_path.startup_cost = 0;
 			sort_path.total_cost = 0;
 			sort_path.rows = subpath->rows;
-- 
2.21.1


--4ms6w442s2ji2wqe
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment;
	filename="0006-Parallel-grouping-sets.patch"
Content-Transfer-Encoding: 8bit



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 7/7] fix
@ 2020-03-19 02:02  Tomas Vondra <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Tomas Vondra @ 2020-03-19 02:02 UTC (permalink / raw)

---
 src/backend/executor/nodeAgg.c       | 20 ++++++++++----------
 src/backend/jit/llvm/llvmjit_expr.c  |  2 +-
 src/backend/optimizer/plan/planner.c | 12 ++++++------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index f7b98dd798..51c7f229e2 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -360,7 +360,7 @@ initialize_phase(AggState *aggstate, int newphase)
 		if (persort->store_in)
 		{
 			tuplestore_end(persort->store_in);
-			persort->store_in = NULL;	
+			persort->store_in = NULL;
 		}
 	}
 
@@ -2017,7 +2017,7 @@ agg_preprocess_groupingsets(AggState *aggstate)
 	/* Initialize tuples storage for each aggregate phases */
 	for (phaseidx = 0; phaseidx < aggstate->numphases; phaseidx++)
 	{
-		phase = aggstate->phases[phaseidx];	
+		phase = aggstate->phases[phaseidx];
 
 		if (!phase->is_hashed)
 		{
@@ -2039,12 +2039,12 @@ agg_preprocess_groupingsets(AggState *aggstate)
 			}
 			else
 			{
-				persort->store_in = tuplestore_begin_heap(false, false, work_mem);	
+				persort->store_in = tuplestore_begin_heap(false, false, work_mem);
 			}
 		}
 		else
 		{
-			/* 
+			/*
 			 * If it's a AGG_HASHED, we don't need a storage to store
 			 * the tuples for later process, we can do the transition
 			 * immediately.
@@ -2422,7 +2422,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 	aggstate->maxsets = numGroupingSets;
 	aggstate->numphases = 1 + list_length(node->chain);
 
-	/* 
+	/*
 	 * We are doing final stage of partial groupingsets, do preprocess
 	 * to input tuples first, redirect the tuples to according aggregate
 	 * phases. See agg_preprocess_groupingsets().
@@ -2431,7 +2431,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 	{
 		aggstate->groupingsets_preprocess = true;
 
-		/* 
+		/*
 		 * Allocate gsetid <-> phases mapping, in final stage of
 		 * partial groupingsets, all grouping sets are extracted
 		 * to individual phases, so the number of sets is equal
@@ -2449,7 +2449,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 	 * agg_sort_input(), this can only happen in groupingsets case.
 	 */
 	if (node->sortnode)
-		aggstate->input_sorted = false;	
+		aggstate->input_sorted = false;
 
 	aggstate->aggcontexts = (ExprContext **)
 		palloc0(sizeof(ExprContext *) * numGroupingSets);
@@ -2626,7 +2626,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 				phasedata->setno_gsetids[0] = gs->setId;
 			}
 
-			/* 
+			/*
 			 * Initialize pergroup state. For AGG_HASHED, all groups do transition
 			 * on the fly, all pergroup states are kept in hashtable, everytime
 			 * a tuple is processed, lookup_hash_entry() choose one group and
@@ -2688,7 +2688,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
 					phasedata->grouped_cols[i] = cols;
 					phasedata->gset_lengths[i] = current_length;
 
-					/* 
+					/*
 					 * In the initial stage of partial grouping sets, it provides extra
 					 * grouping sets ID in the targetlist, fill the setno <-> gsetid
 					 * map, so EEOP_GROUPING_SET_ID can evaluate correct gsetid for
@@ -3871,7 +3871,7 @@ ExecReScanAgg(AggState *node)
 			}
 		}
 
-		/* 
+		/*
 		 * if the agg is doing final stage of partial groupingsets, reset the
 		 * flag to do groupingsets preprocess again.
 		 */
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index f442442269..f70eaabd0c 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -1893,7 +1893,7 @@ llvm_compile_expr(ExprState *state)
 					v_aggstatep =
 						LLVMBuildBitCast(b, v_parent, l_ptr(StructAggState), "");
 
-					/* 
+					/*
 					 * op->resvalue =
 					 * aggstate->phase->setno_gsetids
 					 * [aggstate->current_set]
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index cedd3e1c9d..a0186091a1 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -4211,7 +4211,7 @@ create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
  * added to grouped_rel->pathlist. And aggsplit value is not sufficient to
  * make a decision.
  */
-static void 
+static void
 consider_groupingsets_paths(PlannerInfo *root,
 							RelOptInfo *grouped_rel,
 							Path *path,
@@ -4601,7 +4601,7 @@ consider_groupingsets_paths(PlannerInfo *root,
 	}
 }
 
-/* 
+/*
  * If we are combining the partial groupingsets aggregation, the input is
  * mixed with tuples from different grouping sets, executor dispatch the
  * tuples to different rollups (phases) according to the grouping set id.
@@ -4644,7 +4644,7 @@ extract_final_rollups(PlannerInfo *root,
 			{
 				new_rollup->groupClause = NIL;
 				new_rollup->gsets_data = list_make1(gs);
-				new_rollup->gsets = list_make1(NIL); 
+				new_rollup->gsets = list_make1(NIL);
 				new_rollup->hashable = false;
 				new_rollup->is_hashed = false;
 			}
@@ -5364,7 +5364,7 @@ make_partial_grouping_target(PlannerInfo *root,
 
 	add_new_columns_to_pathtarget(partial_target, non_group_exprs);
 
-	/* 
+	/*
 	 * We are generate partial groupingsets path, add an expression to show
 	 * the grouping set ID for a tuple, so in the final stage, executor can
 	 * know which set this tuple belongs to and combine them.
@@ -6985,7 +6985,7 @@ create_partial_grouping_paths(PlannerInfo *root,
 													 path,
 													 root->group_pathkeys,
 													 -1.0);
-				
+
 				if (parse->hasAggs)
 					add_partial_path(partially_grouped_rel, (Path *)
 									 create_agg_path(root,
@@ -7059,7 +7059,7 @@ create_partial_grouping_paths(PlannerInfo *root,
 										AGGSPLIT_INITIAL_SERIAL,
 										add_partial_path);
 		}
-		else 
+		else
 		{
 			hashaggtablesize =
 				estimate_hashagg_tablesize(cheapest_partial_path,
-- 
2.21.1


--4ms6w442s2ji2wqe--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2020-06-15 10:28  Your Name <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Your Name @ 2020-06-15 10:28 UTC (permalink / raw)

---
 src/bin/pg_dump/t/002_pg_dump.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 8c89488a12..d28988b870 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -154,6 +154,8 @@ my %pgdump_runs = (
 		test_key => 'defaults',
 		dump_cmd => [
 			[ 'pg_dump', '-Fc', '-Z6', '--no-sync', 'postgres', ],
+			'|',
+			[ 'perl', '-pe', '', ],
 			'>', "$tempdir/defaults_custom_format_no_seek_parallel_restore.dump", # stdout disables seeking
 		],
 		restore_cmd => [
-- 
2.24.2


--K3vkeaB0MlFjg8U+--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/2] fix
@ 2020-08-01 02:24  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-08-01 02:24 UTC (permalink / raw)

---
 src/backend/access/heap/vacuumlazy.c | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 78d1db9ae2..b6015c9297 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1860,7 +1860,6 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 
 		tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		vacrelstats->blkno = tblk;
-		vacrelstats->offnum = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples->itemptrs[tupindex]);
 		buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
 								 vac_strategy);
 		if (!ConditionalLockBufferForCleanup(buf))
@@ -1937,7 +1936,6 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer,
 		if (tblk != blkno)
 			break;				/* past end of tuples for this block */
 		toff = ItemPointerGetOffsetNumber(&dead_tuples->itemptrs[tupindex]);
-		vacrelstats->offnum = toff;
 		itemid = PageGetItemId(page, toff);
 		ItemIdSetUnused(itemid);
 		unused[uncnt++] = toff;
@@ -2022,6 +2020,7 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	OffsetNumber offnum,
 				maxoff;
 	HeapTupleHeader tupleheader;
+	LVSavedErrInfo saved_err_info;
 
 	*hastup = false;
 
@@ -2034,6 +2033,11 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 	if (PageIsNew(page) || PageIsEmpty(page))
 		return false;
 
+	/* Update error traceback information */
+	update_vacuum_error_info(vacrelstats, &saved_err_info,
+			VACUUM_ERRCB_PHASE_SCAN_HEAP, vacrelstats->blkno,
+			InvalidOffsetNumber);
+
 	maxoff = PageGetMaxOffsetNumber(page);
 	for (offnum = FirstOffsetNumber;
 		 offnum <= maxoff;
@@ -2056,10 +2060,13 @@ lazy_check_needs_freeze(Buffer buf, bool *hastup, LVRelStats *vacrelstats)
 
 		if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
 									MultiXactCutoff, buf))
-			return true;
+			break;
 	}							/* scan along page */
 
-	return false;
+	/* Revert to the previous phase information for error traceback */
+	restore_vacuum_error_info(vacrelstats, &saved_err_info);
+
+	return offnum <= maxoff ? true : false;
 }
 
 /*
@@ -2501,7 +2508,7 @@ lazy_cleanup_index(Relation indrel,
 
 	*stats = index_vacuum_cleanup(&ivinfo, *stats);
 
-	/* Revert back to the old phase information for error traceback */
+	/* Revert to the old phase information for error traceback */
 	restore_vacuum_error_info(vacrelstats, &saved_err_info);
 	pfree(vacrelstats->indname);
 	vacrelstats->indname = NULL;
@@ -3590,8 +3597,8 @@ vacuum_error_callback(void *arg)
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
 				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
+					errcontext("while scanning block %u of relation \"%s.%s\", item offset %u",
+							   errinfo->blkno, errinfo->relnamespace, errinfo->relname, errinfo->offnum);
 				else
 					errcontext("while scanning block %u of relation \"%s.%s\"",
 							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
@@ -3601,12 +3608,8 @@ vacuum_error_callback(void *arg)
 		case VACUUM_ERRCB_PHASE_VACUUM_HEAP:
 			if (BlockNumberIsValid(errinfo->blkno))
 			{
-				if (OffsetNumberIsValid(errinfo->offnum))
-					errcontext("while vacuuming block %u and offset %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);
-				else
-					errcontext("while vacuuming block %u of relation \"%s.%s\"",
-							   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+				errcontext("while vacuuming block %u of relation \"%s.%s\"",
+						   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
 			}
 			break;
 
-- 
2.17.0


--OQhbRXNHSL5w/5po--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH v34 2/8] fix
@ 2020-12-12 17:42  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2020-12-12 17:42 UTC (permalink / raw)

---
 src/backend/catalog/index.c      | 23 ++++++-----
 src/backend/commands/cluster.c   |  3 +-
 src/backend/commands/indexcmds.c | 68 ++++++++++++++++----------------
 src/backend/commands/tablecmds.c |  4 +-
 src/backend/tcop/utility.c       |  6 +--
 src/include/catalog/index.h      |  4 +-
 src/include/commands/defrem.h    |  6 +--
 7 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 06342fddf1..da2f45b796 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -3594,7 +3594,7 @@ IndexGetRelation(Oid indexId, bool missing_ok)
  */
 void
 reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
-			  ReindexOptions options)
+			  ReindexOptions *options)
 {
 	Relation	iRel,
 				heapRelation;
@@ -3602,7 +3602,6 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 	IndexInfo  *indexInfo;
 	volatile bool skipped_constraint = false;
 	PGRUsage	ru0;
-	bool		progress = options.REINDEXOPT_REPORT_PROGRESS;
 
 	pg_rusage_init(&ru0);
 
@@ -3611,12 +3610,12 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 	 * we only need to be sure no schema or data changes are going on.
 	 */
 	heapId = IndexGetRelation(indexId,
-							  options.REINDEXOPT_MISSING_OK);
+							  options->REINDEXOPT_MISSING_OK);
 	/* if relation is missing, leave */
 	if (!OidIsValid(heapId))
 		return;
 
-	if (options.REINDEXOPT_MISSING_OK)
+	if (options->REINDEXOPT_MISSING_OK)
 		heapRelation = try_table_open(heapId, ShareLock);
 	else
 		heapRelation = table_open(heapId, ShareLock);
@@ -3625,7 +3624,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 	if (!heapRelation)
 		return;
 
-	if (progress)
+	if (options->REINDEXOPT_REPORT_PROGRESS)
 	{
 		pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
 									  heapId);
@@ -3641,7 +3640,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 	 */
 	iRel = index_open(indexId, AccessExclusiveLock);
 
-	if (progress)
+	if (options->REINDEXOPT_REPORT_PROGRESS)
 		pgstat_progress_update_param(PROGRESS_CREATEIDX_ACCESS_METHOD_OID,
 									 iRel->rd_rel->relam);
 
@@ -3792,14 +3791,14 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 	}
 
 	/* Log what we did */
-	if (options.REINDEXOPT_VERBOSE)
+	if (options->REINDEXOPT_VERBOSE)
 		ereport(INFO,
 				(errmsg("index \"%s\" was reindexed",
 						get_rel_name(indexId)),
 				 errdetail_internal("%s",
 									pg_rusage_show(&ru0))));
 
-	if (progress)
+	if (options->REINDEXOPT_REPORT_PROGRESS)
 		pgstat_progress_end_command();
 
 	/* Close rels, but keep locks */
@@ -3846,7 +3845,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
  * index rebuild.
  */
 bool
-reindex_relation(Oid relid, int flags, ReindexOptions options)
+reindex_relation(Oid relid, int flags, ReindexOptions *options)
 {
 	Relation	rel;
 	Oid			toast_relid;
@@ -3861,7 +3860,7 @@ reindex_relation(Oid relid, int flags, ReindexOptions options)
 	 * to prevent schema and data changes in it.  The lock level used here
 	 * should match ReindexTable().
 	 */
-	if (options.REINDEXOPT_MISSING_OK)
+	if (options->REINDEXOPT_MISSING_OK)
 		rel = try_table_open(relid, ShareLock);
 	else
 		rel = table_open(relid, ShareLock);
@@ -3965,9 +3964,9 @@ reindex_relation(Oid relid, int flags, ReindexOptions options)
 		 * Note that this should fail if the toast relation is missing, so
 		 * reset REINDEXOPT_MISSING_OK.
 		 */
-		ReindexOptions newoptions = options;
+		ReindexOptions newoptions = *options;
 		newoptions.REINDEXOPT_MISSING_OK = false;
-		result |= reindex_relation(toast_relid, flags, newoptions);
+		result |= reindex_relation(toast_relid, flags, &newoptions);
 	}
 
 	return result;
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index b0aa3536d1..272723e050 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -1353,6 +1353,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
 				 char newrelpersistence)
 {
 	ObjectAddress object;
+	ReindexOptions reindexopts = {false};
 	Oid			mapped_tables[4];
 	int			reindex_flags;
 	int			i;
@@ -1412,7 +1413,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
 	pgstat_progress_update_param(PROGRESS_CLUSTER_PHASE,
 								 PROGRESS_CLUSTER_PHASE_REBUILD_INDEX);
 
-	reindex_relation(OIDOldHeap, reindex_flags, (ReindexOptions){});
+	reindex_relation(OIDOldHeap, reindex_flags, &reindexopts);
 
 	/* Report that we are now doing clean up */
 	pgstat_progress_update_param(PROGRESS_CLUSTER_PHASE,
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index cd8eaa732d..d39840d493 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -89,9 +89,9 @@ static List *ChooseIndexColumnNames(List *indexElems);
 static void RangeVarCallbackForReindexIndex(const RangeVar *relation,
 											Oid relId, Oid oldRelId, void *arg);
 static void reindex_error_callback(void *args);
-static void ReindexPartitions(Oid relid, ReindexOptions options, bool isTopLevel);
-static void ReindexMultipleInternal(List *relids, ReindexOptions options);
-static bool ReindexRelationConcurrently(Oid relationOid, ReindexOptions options);
+static void ReindexPartitions(Oid relid, ReindexOptions *options, bool isTopLevel);
+static void ReindexMultipleInternal(List *relids, ReindexOptions *options);
+static bool ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options);
 static void update_relispartition(Oid relationId, bool newval);
 static inline void set_indexsafe_procflags(void);
 
@@ -2459,7 +2459,7 @@ ReindexOptions
 ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt)
 {
 	ListCell   *lc;
-	ReindexOptions options = {};
+	ReindexOptions options = {0};
 
 	/* Parse option list */
 	foreach(lc, stmt->params)
@@ -2486,7 +2486,7 @@ ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt)
  *		Recreate a specific index.
  */
 void
-ReindexIndex(RangeVar *indexRelation, ReindexOptions options, bool isTopLevel)
+ReindexIndex(RangeVar *indexRelation, ReindexOptions *options, bool isTopLevel)
 {
 	struct ReindexIndexCallbackState state;
 	Oid			indOid;
@@ -2503,10 +2503,10 @@ ReindexIndex(RangeVar *indexRelation, ReindexOptions options, bool isTopLevel)
 	 * upgrade the lock, but that's OK, because other sessions can't hold
 	 * locks on our temporary table.
 	 */
-	state.options = options;
+	state.options = *options;
 	state.locked_table_oid = InvalidOid;
 	indOid = RangeVarGetRelidExtended(indexRelation,
-									  options.REINDEXOPT_CONCURRENTLY ?
+									  options->REINDEXOPT_CONCURRENTLY ?
 									  ShareUpdateExclusiveLock : AccessExclusiveLock,
 									  0,
 									  RangeVarCallbackForReindexIndex,
@@ -2521,14 +2521,14 @@ ReindexIndex(RangeVar *indexRelation, ReindexOptions options, bool isTopLevel)
 
 	if (relkind == RELKIND_PARTITIONED_INDEX)
 		ReindexPartitions(indOid, options, isTopLevel);
-	else if (options.REINDEXOPT_CONCURRENTLY &&
+	else if (options->REINDEXOPT_CONCURRENTLY &&
 			 persistence != RELPERSISTENCE_TEMP)
 		ReindexRelationConcurrently(indOid, options);
 	else
 	{
-		ReindexOptions newoptions = options;
+		ReindexOptions newoptions = *options;
 		newoptions.REINDEXOPT_REPORT_PROGRESS = true;
-		reindex_index(indOid, false, persistence, newoptions);
+		reindex_index(indOid, false, persistence, &newoptions);
 	}
 }
 
@@ -2608,7 +2608,7 @@ RangeVarCallbackForReindexIndex(const RangeVar *relation,
  *		Recreate all indexes of a table (and of its toast table, if any)
  */
 Oid
-ReindexTable(RangeVar *relation, ReindexOptions options, bool isTopLevel)
+ReindexTable(RangeVar *relation, ReindexOptions *options, bool isTopLevel)
 {
 	Oid			heapOid;
 	bool		result;
@@ -2622,14 +2622,14 @@ ReindexTable(RangeVar *relation, ReindexOptions options, bool isTopLevel)
 	 * locks on our temporary table.
 	 */
 	heapOid = RangeVarGetRelidExtended(relation,
-									   options.REINDEXOPT_CONCURRENTLY ?
+									   options->REINDEXOPT_CONCURRENTLY ?
 									   ShareUpdateExclusiveLock : ShareLock,
 									   0,
 									   RangeVarCallbackOwnsTable, NULL);
 
 	if (get_rel_relkind(heapOid) == RELKIND_PARTITIONED_TABLE)
 		ReindexPartitions(heapOid, options, isTopLevel);
-	else if (options.REINDEXOPT_CONCURRENTLY &&
+	else if (options->REINDEXOPT_CONCURRENTLY &&
 			 get_rel_persistence(heapOid) != RELPERSISTENCE_TEMP)
 	{
 		result = ReindexRelationConcurrently(heapOid, options);
@@ -2641,12 +2641,12 @@ ReindexTable(RangeVar *relation, ReindexOptions options, bool isTopLevel)
 	}
 	else
 	{
-		ReindexOptions newoptions = options;
+		ReindexOptions newoptions = *options;
 		newoptions.REINDEXOPT_REPORT_PROGRESS = true;
 		result = reindex_relation(heapOid,
 								  REINDEX_REL_PROCESS_TOAST |
 								  REINDEX_REL_CHECK_CONSTRAINTS,
-								  newoptions);
+								  &newoptions);
 		if (!result)
 			ereport(NOTICE,
 					(errmsg("table \"%s\" has no indexes to reindex",
@@ -2666,7 +2666,7 @@ ReindexTable(RangeVar *relation, ReindexOptions options, bool isTopLevel)
  */
 void
 ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
-					  ReindexOptions options)
+					  ReindexOptions *options)
 {
 	Oid			objectOid;
 	Relation	relationRelation;
@@ -2685,7 +2685,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
 		   objectKind == REINDEX_OBJECT_DATABASE);
 
 	if (objectKind == REINDEX_OBJECT_SYSTEM &&
-		options.REINDEXOPT_CONCURRENTLY)
+		options->REINDEXOPT_CONCURRENTLY)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot reindex system catalogs concurrently")));
@@ -2793,7 +2793,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
 		 * Skip system tables, since index_create() would reject indexing them
 		 * concurrently (and it would likely fail if we tried).
 		 */
-		if (options.REINDEXOPT_CONCURRENTLY &&
+		if (options->REINDEXOPT_CONCURRENTLY &&
 			IsCatalogRelationOid(relid))
 		{
 			if (!concurrent_warning)
@@ -2859,7 +2859,7 @@ reindex_error_callback(void *arg)
  * by the caller.
  */
 static void
-ReindexPartitions(Oid relid, ReindexOptions options, bool isTopLevel)
+ReindexPartitions(Oid relid, ReindexOptions *options, bool isTopLevel)
 {
 	List	   *partitions = NIL;
 	char		relkind = get_rel_relkind(relid);
@@ -2954,7 +2954,7 @@ ReindexPartitions(Oid relid, ReindexOptions options, bool isTopLevel)
  * and starts a new transaction when finished.
  */
 static void
-ReindexMultipleInternal(List *relids, ReindexOptions options)
+ReindexMultipleInternal(List *relids, ReindexOptions *options)
 {
 	ListCell   *l;
 
@@ -2990,36 +2990,36 @@ ReindexMultipleInternal(List *relids, ReindexOptions options)
 		Assert(relkind != RELKIND_PARTITIONED_INDEX &&
 			   relkind != RELKIND_PARTITIONED_TABLE);
 
-		if (options.REINDEXOPT_CONCURRENTLY &&
+		if (options->REINDEXOPT_CONCURRENTLY &&
 			relpersistence != RELPERSISTENCE_TEMP)
 		{
-			ReindexOptions newoptions = options;
+			ReindexOptions newoptions = *options;
 			newoptions.REINDEXOPT_MISSING_OK = true;
-			(void) ReindexRelationConcurrently(relid, newoptions);
+			(void) ReindexRelationConcurrently(relid, &newoptions);
 			/* ReindexRelationConcurrently() does the verbose output */
 		}
 		else if (relkind == RELKIND_INDEX)
 		{
-			ReindexOptions newoptions = options;
+			ReindexOptions newoptions = *options;
 			newoptions.REINDEXOPT_REPORT_PROGRESS = true;
 			newoptions.REINDEXOPT_MISSING_OK = true;
-			reindex_index(relid, false, relpersistence, newoptions);
+			reindex_index(relid, false, relpersistence, &newoptions);
 			PopActiveSnapshot();
 			/* reindex_index() does the verbose output */
 		}
 		else
 		{
 			bool		result;
-			ReindexOptions newoptions = options;
+			ReindexOptions newoptions = *options;
 			newoptions.REINDEXOPT_REPORT_PROGRESS = true;
 			newoptions.REINDEXOPT_MISSING_OK = true;
 
 			result = reindex_relation(relid,
 									  REINDEX_REL_PROCESS_TOAST |
 									  REINDEX_REL_CHECK_CONSTRAINTS,
-									  newoptions);
+									  &newoptions);
 
-			if (result && options.REINDEXOPT_VERBOSE)
+			if (result && options->REINDEXOPT_VERBOSE)
 				ereport(INFO,
 						(errmsg("table \"%s.%s\" was reindexed",
 								get_namespace_name(get_rel_namespace(relid)),
@@ -3059,7 +3059,7 @@ ReindexMultipleInternal(List *relids, ReindexOptions options)
  * anyway, and a non-concurrent reindex is more efficient.
  */
 static bool
-ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
+ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options)
 {
 	List	   *heapRelationIds = NIL;
 	List	   *indexIds = NIL;
@@ -3092,7 +3092,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
 											"ReindexConcurrent",
 											ALLOCSET_SMALL_SIZES);
 
-	if (options.REINDEXOPT_VERBOSE)
+	if (options->REINDEXOPT_VERBOSE)
 	{
 		/* Save data needed by REINDEX VERBOSE in private context */
 		oldcontext = MemoryContextSwitchTo(private_context);
@@ -3137,7 +3137,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
 							 errmsg("cannot reindex system catalogs concurrently")));
 
 				/* Open relation to get its indexes */
-				if (options.REINDEXOPT_MISSING_OK)
+				if (options->REINDEXOPT_MISSING_OK)
 				{
 					heapRelation = try_table_open(relationOid,
 												  ShareUpdateExclusiveLock);
@@ -3233,7 +3233,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
 		case RELKIND_INDEX:
 			{
 				Oid			heapId = IndexGetRelation(relationOid,
-													  options.REINDEXOPT_MISSING_OK);
+													  options->REINDEXOPT_MISSING_OK);
 				Relation	heapRelation;
 
 				/* if relation is missing, leave */
@@ -3262,7 +3262,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
 				 * to rebuild is not complete yet, and REINDEXOPT_MISSING_OK
 				 * should not be used once all the session locks are taken.
 				 */
-				if (options.REINDEXOPT_MISSING_OK)
+				if (options->REINDEXOPT_MISSING_OK)
 				{
 					heapRelation = try_table_open(heapId,
 												  ShareUpdateExclusiveLock);
@@ -3754,7 +3754,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions options)
 	StartTransactionCommand();
 
 	/* Log what we did */
-	if (options.REINDEXOPT_VERBOSE)
+	if (options->REINDEXOPT_VERBOSE)
 	{
 		if (relkind == RELKIND_INDEX)
 			ereport(INFO,
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 9f218ac0e4..e0f62d3c77 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -1854,6 +1854,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
 		{
 			Oid			heap_relid;
 			Oid			toast_relid;
+			ReindexOptions reindexopts = {false}; /* Default options are all false */
 
 			/*
 			 * This effectively deletes all rows in the table, and may be done
@@ -1891,7 +1892,8 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
 			/*
 			 * Reconstruct the indexes to match, and we're done.
 			 */
-			reindex_relation(heap_relid, REINDEX_REL_PROCESS_TOAST, (ReindexOptions){});
+			reindex_relation(heap_relid, REINDEX_REL_PROCESS_TOAST,
+					&reindexopts);
 		}
 
 		pgstat_count_truncate(rel);
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index e5a4e8f662..23612b7a90 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -929,10 +929,10 @@ standard_ProcessUtility(PlannedStmt *pstmt,
 				switch (stmt->kind)
 				{
 					case REINDEX_OBJECT_INDEX:
-						ReindexIndex(stmt->relation, options, isTopLevel);
+						ReindexIndex(stmt->relation, &options, isTopLevel);
 						break;
 					case REINDEX_OBJECT_TABLE:
-						ReindexTable(stmt->relation, options, isTopLevel);
+						ReindexTable(stmt->relation, &options, isTopLevel);
 						break;
 					case REINDEX_OBJECT_SCHEMA:
 					case REINDEX_OBJECT_SYSTEM:
@@ -948,7 +948,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
 												  (stmt->kind == REINDEX_OBJECT_SCHEMA) ? "REINDEX SCHEMA" :
 												  (stmt->kind == REINDEX_OBJECT_SYSTEM) ? "REINDEX SYSTEM" :
 												  "REINDEX DATABASE");
-						ReindexMultipleTables(stmt->name, stmt->kind, options);
+						ReindexMultipleTables(stmt->name, stmt->kind, &options);
 						break;
 					default:
 						elog(ERROR, "unrecognized object type: %d",
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index 81e3de4d22..3a8671f558 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -146,7 +146,7 @@ extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action);
 extern Oid	IndexGetRelation(Oid indexId, bool missing_ok);
 
 extern void reindex_index(Oid indexId, bool skip_constraint_checks,
-						  char relpersistence, ReindexOptions options);
+						  char relpersistence, ReindexOptions *options);
 
 /* Flag bits for reindex_relation(): */
 #define REINDEX_REL_PROCESS_TOAST			0x01
@@ -155,7 +155,7 @@ extern void reindex_index(Oid indexId, bool skip_constraint_checks,
 #define REINDEX_REL_FORCE_INDEXES_UNLOGGED	0x08
 #define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10
 
-extern bool reindex_relation(Oid relid, int flags, ReindexOptions options);
+extern bool reindex_relation(Oid relid, int flags, ReindexOptions *options);
 
 extern bool ReindexIsProcessingHeap(Oid heapOid);
 extern bool ReindexIsProcessingIndex(Oid indexOid);
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 5b1a60d5fa..33df5d5780 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -36,10 +36,10 @@ extern ObjectAddress DefineIndex(Oid relationId,
 								 bool skip_build,
 								 bool quiet);
 extern ReindexOptions ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt);
-extern void ReindexIndex(RangeVar *indexRelation, ReindexOptions options, bool isTopLevel);
-extern Oid	ReindexTable(RangeVar *relation, ReindexOptions options, bool isTopLevel);
+extern void ReindexIndex(RangeVar *indexRelation, ReindexOptions *options, bool isTopLevel);
+extern Oid	ReindexTable(RangeVar *relation, ReindexOptions *options, bool isTopLevel);
 extern void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
-								  ReindexOptions options);
+								  ReindexOptions *options);
 extern char *makeObjectName(const char *name1, const char *name2,
 							const char *label);
 extern char *ChooseRelationName(const char *name1, const char *name2,
-- 
2.17.0


--ucW7QTJbHsz5ya91
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v34-0003-ExecReindex-and-ReindexParams.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH] fix
@ 2021-01-10 21:41  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-01-10 21:41 UTC (permalink / raw)

---
 src/backend/commands/tablecmds.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		Oid		partrelid,
 				parentrelid;
 		LOCKTAG		tag;
+		LockRelId	partlockrelid;
 		char   *parentrelname;
 		char   *partrelname;
 
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		table_close(rel, NoLock);
 		tab->rel = NULL;
 
+		partlockrelid.relId = parentrelid;
+		partlockrelid.dbId = MyDatabaseId;
+		LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
 		/* Make updated catalog entry visible */
 		PopActiveSnapshot();
 		CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 					 errmsg("partition \"%s\" was removed concurrently", partrelname)));
 
 		tab->rel = rel;
-
+		UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
 	}
 
 	/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
 	TupleDesc	td = RelationGetDescr(partRel);
 	Constraint *n;
 
-	constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+	List *l = RelationGetPartitionQual(partRel);
+	Assert(partRel->rd_rel->relispartition);
+	Assert(l != NIL);
+	constraintExpr = make_ands_explicit(l);
 
 	/* If an identical constraint exists, we don't need to create one */
 	if (td->constr && td->constr->num_check > 0)
-- 
2.17.0


--kR3zbvD4cgoYnS/6--





^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* [PATCH 2/3] fix
@ 2021-03-13 21:51  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: Justin Pryzby @ 2021-03-13 21:51 UTC (permalink / raw)

---
 src/backend/access/gin/ginarrayproc.c | 3 ++-
 src/test/regress/expected/gin.out     | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index b10bd04ec8..983cc42a86 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -93,7 +93,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
 	if (strategy == GinContainsElemStrategy)
 	{
 		/* single element is passed, set elems to its pointer */
-		elems = &PG_GETARG_DATUM(0);
+		elems = palloc(sizeof(*elems));
+		*elems = PG_GETARG_DATUM(0);
 		nulls = &PG_ARGISNULL(0);
 		nelems = 1;
 	}
diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out
index 698d322e14..7fc7436646 100644
--- a/src/test/regress/expected/gin.out
+++ b/src/test/regress/expected/gin.out
@@ -78,13 +78,13 @@ select count(*) from gin_test_tbl where i @>> 999;
 select count(*) from gin_test_tbl where i @>> 1;
  count 
 -------
-     3
+  2997
 (1 row)
 
 select count(*) from gin_test_tbl where i @>> 999;
  count 
 -------
-     0
+     3
 (1 row)
 
 -- Very weak test for gin_fuzzy_search_limit
-- 
2.17.0


--opg8F0UgoHELSI+9
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-fk_arrays_elems.patch"



^ permalink  raw  reply  [nested|flat] 70+ messages in thread

* Re: optimize hashjoin
@ 2024-08-22 12:08  bucoo <[email protected]>
  0 siblings, 0 replies; 70+ messages in thread

From: bucoo @ 2024-08-22 12:08 UTC (permalink / raw)
  To: Tomas Vondra <[email protected]>; pgsql-hackers; +Cc: 'Tom Lane' <[email protected]>; 'Robert Haas' <[email protected]>

------=_Part_35779_1338760973.1724328493004
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: base64

PHA+PGJyLz4mZ3Q7IDApIFRoZSBwYXRjaCBkb2VzIG5vdCBhcHBseSBhbnltb3JlLCB0aGFua3Mg
dG8gRGF2aWQgY29tbWl0dGluZyBhIHBhdGNoPC9wPjxwPiZndDsgeWVzdGVyZGF5LiBBdHRhY2hl
ZCBpcyBhIHBhdGNoIHJlYmFzZWQgb24gdG9wIG9mIGN1cnJlbnQgbWFzdGVyLjwvcD48cD5UaGF0
IHBhdGNoIGlzIGJhc2VkIG9uIFBHMTcuIEkgaGF2ZSBub3cgcmV3cml0dGVuIGl0IGJhc2VkIG9u
IHRoZSBtYXN0ZXIgYnJhbmNoIGFuZCBhZGRlZCBzb21lIGNvbW1lbnRzLjwvcD48cD48YnIvPiZn
dDsgMSkgV291bGRuJiMzOTt0IGl0IGJlIGVhc2llciAoYW5kIGp1c3QgYXMgZWZmaWNpZW50KSB0
byB1c2Ugc2xvdHMgd2l0aDwvcD48cD4mZ3Q7IFRUU09wc01pbmltYWxUdXBsZSwgaS5lLiBiYWNr
ZWQgYnkgYSBtaW5pbWFsIHR1cGxlPzwvcD48cD5Vc2UgZGlmZmVudCBraW5kIG9mIHNsb3QsIHRo
ZSBFeGVjRXZhbEV4cHIgZnVuY3Rpb24gd2lsbCByZXBvcnQgYW4gZXJyb3IuPGJyLz48L3A+PHA+
PGJyLz4KICZndDsgMikgSSBmaW5kIHRoZSBuYW1pbmcgb2YgdGhlIG5ldyBmdW5jdGlvbnMgYSBi
aXQgY29uZnVzaW5nLiBXZSBub3cgaGF2ZTxici8+Jmd0OyB0aGUgJnF1b3Q7b3JpZ2luYWwmcXVv
dDsgZnVuY3Rpb25zIH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pbmc8YnIvPiZndDsgZXhlY3V0aW9uLCBpbiB3aGlj
aCBjYXNlIHdlIG5lZWQgdG8gbW92ZSB0dXBsZXMgdG8gdGhlIHJpZ2h0IGJhdGNoLjwvcD48cD5P
bmx5IHBhcmFsbGVsIEhhc2hKb2luIHNwZWVkIHVwIHRvIH4yeChhbGwgZGF0YSBjYWNoZWQgaW4g
bWVtb3J5KSw8L3A+PHA+bm90IGZ1bGwgcXVlcnksIGluY2x1ZGUgbm9uLXBhcmFsbGVsIEhhc2hK
b2luLjwvcD48cD5ub24tcGFyYWxsZWwgSGFzaEpvaW4gb25seSB3aGVuIGJhdGNocyBsYXJnZSB0
aGVuIG9uZSB3aWxsIHNwZWVkIHVwLDwvcD48cD5iZWNhdXNlIHRoaXMgcGF0Y2ggb25seSBvcHRp
bWl6ZSBmb3IgcmVhZCBiYXRjaHMgdHVwbGVzIHRvIG1lbW9yeS48YnIvPjwvcD48YnIvPjxici8+
PGJyLz48ZGl2PjxhIGhyZWY9Imh0dHBzOi8vYS5hcHAucXEuY29tL28vc2ltcGxlLmpzcD9wa2du
YW1lPWNvbS5zb2h1Lm1haWwuY2xpZW50LmNvcmRvdmEiPjxpbWcgIGJvcmRlcj0iMCIgc3JjPSIv
LzFjYmJiMmQxNDg3NTMuY2RuLnNvaHVjcy5jb20vbWFpbC9pbWFnZXMvc2NvcmVfYWRfZm9vdDFf
NzUweDc5LnBuZyIvPiA8L2E+PC9kaXY+Cjxici8+PGJyLz48YnIvPg==
------=_Part_35779_1338760973.1724328493004
Content-Type: application/octet-stream; name=optimize-hashjoin-master.patch
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=optimize-hashjoin-master.patch
Content-Length: 12172

ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL2V4ZWN1dG9yL25vZGVIYXNoLmMgYi9zcmMvYmFja2Vu
ZC9leGVjdXRvci9ub2RlSGFzaC5jCmluZGV4IDU3MGE5MGViZTEuLjVlNzAyYTM3ZmYgMTAwNj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GVzL2V4ZWNub2Rlcy5oCkBAIC0yMjI1LDYgKzIyMjUsNyBAQCB0
eXBlZGVmIHN0cnVjdCBIYXNoSm9pblN0YXRlCiAJVHVwbGVUYWJsZVNsb3QgKmhqX051bGxPdXRl
clR1cGxlU2xvdDsKIAlUdXBsZVRhYmxlU2xvdCAqaGpfTnVsbElubmVyVHVwbGVTbG90OwogCVR1
cGxlVGFibGVTbG90ICpoal9GaXJzdE91dGVyVHVwbGVTbG90OworCVN0cmluZ0luZm8JaGpfb3V0
ZXJUdXBsZUJ1ZmZlcjsKIAlpbnQJCQloal9Kb2luU3RhdGU7CiAJYm9vbAkJaGpfTWF0Y2hlZE91
dGVyOwogCWJvb2wJCWhqX091dGVyTm90RW1wdHk7Cg==
------=_Part_35779_1338760973.1724328493004--






Attachments:

  [application/octet-stream] optimize-hashjoin-master.patch (11.9K, ../../[email protected]/2-optimize-hashjoin-master.patch)
  download | inline diff:
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 570a90ebe1..5e702a37ff 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -190,7 +190,7 @@ MultiExecPrivateHash(HashState *node)
 			else
 			{
 				/* Not subject to skew optimization, so insert normally */
-				ExecHashTableInsert(hashtable, slot, hashvalue);
+				ExecHashTableInsertSlot(hashtable, slot, hashvalue);
 			}
 			hashtable->totalTuples += 1;
 		}
@@ -1594,7 +1594,7 @@ ExecParallelHashIncreaseNumBuckets(HashJoinTable hashtable)
 }
 
 /*
- * ExecHashTableInsert
+ * ExecHashTableInsertSlot
  *		insert a tuple into the hash table depending on the hash value
  *		it may just go to a temp file for later batches
  *
@@ -1605,12 +1605,29 @@ ExecParallelHashIncreaseNumBuckets(HashJoinTable hashtable)
  * worth the messiness required.
  */
 void
-ExecHashTableInsert(HashJoinTable hashtable,
-					TupleTableSlot *slot,
-					uint32 hashvalue)
+ExecHashTableInsertSlot(HashJoinTable hashtable,
+						TupleTableSlot *slot,
+						uint32 hashvalue)
 {
 	bool		shouldFree;
 	MinimalTuple tuple = ExecFetchSlotMinimalTuple(slot, &shouldFree);
+
+	ExecHashTableInsertTuple(hashtable, tuple, hashvalue);
+
+	if (shouldFree)
+		heap_free_minimal_tuple(tuple);
+}
+
+/*
+ * ExecHashTableInsertTuple
+ *		insert a tuple into the hash table depending on the hash value
+ *		it may just go to a temp file for later batches
+ */
+void
+ExecHashTableInsertTuple(HashJoinTable hashtable,
+						 MinimalTuple tuple,
+						 uint32 hashvalue)
+{
 	int			bucketno;
 	int			batchno;
 
@@ -1685,9 +1702,6 @@ ExecHashTableInsert(HashJoinTable hashtable,
 							  &hashtable->innerBatchFile[batchno],
 							  hashtable);
 	}
-
-	if (shouldFree)
-		heap_free_minimal_tuple(tuple);
 }
 
 /*
@@ -1761,12 +1775,10 @@ retry:
  * tuples that belong in the current batch once growth has been disabled.
  */
 void
-ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable,
-										TupleTableSlot *slot,
-										uint32 hashvalue)
+ExecParallelHashTableInsertTupleCurrentBatch(HashJoinTable hashtable,
+											 MinimalTuple tuple,
+											 uint32 hashvalue)
 {
-	bool		shouldFree;
-	MinimalTuple tuple = ExecFetchSlotMinimalTuple(slot, &shouldFree);
 	HashJoinTuple hashTuple;
 	dsa_pointer shared;
 	int			batchno;
@@ -1782,6 +1794,21 @@ ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable,
 	HeapTupleHeaderClearMatch(HJTUPLE_MINTUPLE(hashTuple));
 	ExecParallelHashPushTuple(&hashtable->buckets.shared[bucketno],
 							  hashTuple, shared);
+}
+
+/*
+ * like ExecParallelHashTableInsertTupleCurrentBatch,
+ * but this function accept a TupleTableSlot
+ */
+void
+ExecParallelHashTableInsertSlotCurrentBatch(HashJoinTable hashtable,
+										TupleTableSlot *slot,
+										uint32 hashvalue)
+{
+	bool		shouldFree;
+	MinimalTuple tuple = ExecFetchSlotMinimalTuple(slot, &shouldFree);
+
+	ExecParallelHashTableInsertTupleCurrentBatch(hashtable, tuple, hashvalue);
 
 	if (shouldFree)
 		heap_free_minimal_tuple(tuple);
@@ -2454,7 +2481,7 @@ ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue)
  *		Insert a tuple into the skew hashtable.
  *
  * This should generally match up with the current-batch case in
- * ExecHashTableInsert.
+ * ExecHashTableInsertSlot.
  */
 static void
 ExecHashSkewTableInsert(HashJoinTable hashtable,
@@ -2534,8 +2561,8 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
 		Size		tupleSize;
 
 		/*
-		 * This code must agree with ExecHashTableInsert.  We do not use
-		 * ExecHashTableInsert directly as ExecHashTableInsert expects a
+		 * This code must agree with ExecHashTableInsertSlot.  We do not use
+		 * ExecHashTableInsertSlot directly as ExecHashTableInsertSlot expects a
 		 * TupleTableSlot while we already have HashJoinTuples.
 		 */
 		tuple = HJTUPLE_MINTUPLE(hashTuple);
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 2f7170604d..ba5c1d4b49 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -195,10 +195,10 @@ static TupleTableSlot *ExecHashJoinOuterGetTuple(PlanState *outerNode,
 static TupleTableSlot *ExecParallelHashJoinOuterGetTuple(PlanState *outerNode,
 														 HashJoinState *hjstate,
 														 uint32 *hashvalue);
-static TupleTableSlot *ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
-												 BufFile *file,
-												 uint32 *hashvalue,
-												 TupleTableSlot *tupleSlot);
+static MinimalTuple ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
+											  BufFile *file,
+											  uint32 *hashvalue,
+											  StringInfo buf);
 static bool ExecHashJoinNewBatch(HashJoinState *hjstate);
 static bool ExecParallelHashJoinNewBatch(HashJoinState *hjstate);
 static void ExecParallelHashJoinPartitionOuter(HashJoinState *hjstate);
@@ -925,6 +925,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
 	 */
 	hjstate->hj_HashTable = NULL;
 	hjstate->hj_FirstOuterTupleSlot = NULL;
+	hjstate->hj_outerTupleBuffer = NULL;
 
 	hjstate->hj_CurHashValue = 0;
 	hjstate->hj_CurBucketNo = 0;
@@ -1030,6 +1031,7 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
 	}
 	else if (curbatch < hashtable->nbatch)
 	{
+		MinimalTuple mtup;
 		BufFile    *file = hashtable->outerBatchFile[curbatch];
 
 		/*
@@ -1039,12 +1041,38 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
 		if (file == NULL)
 			return NULL;
 
-		slot = ExecHashJoinGetSavedTuple(hjstate,
+		if (unlikely(hjstate->hj_outerTupleBuffer == NULL))
+		{
+			/*
+			 * Avoid realloc memory for MinimalTuple, we alloc a buffer
+			 * to reuse store MinimalTuple. MemoryContext same as hjstate.
+			 */
+			MemoryContext oldcontext = MemoryContextSwitchTo(GetMemoryChunkContext(hjstate));
+			hjstate->hj_outerTupleBuffer = makeStringInfo();
+			MemoryContextSwitchTo(oldcontext);
+		}
+
+		mtup = ExecHashJoinGetSavedTuple(hjstate,
 										 file,
 										 hashvalue,
-										 hjstate->hj_OuterTupleSlot);
-		if (!TupIsNull(slot))
+										 hjstate->hj_outerTupleBuffer);
+		if (likely(mtup != NULL))
+		{
+			slot = hjstate->hj_OuterTupleSlot;
+
+			/*
+			 * mtup is hold in hjstate->hj_outerTupleBuffer, so we can using
+			 * shouldFree as false to call ExecForceStoreMinimalTuple().
+			 * 
+			 * When slot is TTSOpsMinimalTuple we can avoid realloc memory for
+			 * new MinimalTuple(reuse StringInfo to call ExecHashJoinGetSavedTuple).
+			 * 
+			 * More importantly, in non-TTSOpsMinimalTuple scenarios, it can avoid
+			 * reform(materialize) tuple(see ExecForceStoreMinimalTuple).
+			 */
+			ExecForceStoreMinimalTuple(mtup, slot, false);
 			return slot;
+		}
 	}
 
 	/* End of this batch */
@@ -1133,7 +1161,6 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
 	int			nbatch;
 	int			curbatch;
 	BufFile    *innerFile;
-	TupleTableSlot *slot;
 	uint32		hashvalue;
 
 	nbatch = hashtable->nbatch;
@@ -1224,21 +1251,25 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
 
 	if (innerFile != NULL)
 	{
+		StringInfoData buf;
+		MinimalTuple tuple;
+
 		if (BufFileSeek(innerFile, 0, 0, SEEK_SET))
 			ereport(ERROR,
 					(errcode_for_file_access(),
 					 errmsg("could not rewind hash-join temporary file")));
 
-		while ((slot = ExecHashJoinGetSavedTuple(hjstate,
-												 innerFile,
-												 &hashvalue,
-												 hjstate->hj_HashTupleSlot)))
+		initStringInfo(&buf);
+		while ((tuple = ExecHashJoinGetSavedTuple(hjstate,
+												  innerFile,
+												  &hashvalue,
+												  &buf)))
 		{
 			/*
 			 * NOTE: some tuples may be sent to future batches.  Also, it is
 			 * possible for hashtable->nbatch to be increased here!
 			 */
-			ExecHashTableInsert(hashtable, slot, hashvalue);
+			ExecHashTableInsertTuple(hashtable, tuple, hashvalue);
 		}
 
 		/*
@@ -1247,6 +1278,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
 		 */
 		BufFileClose(innerFile);
 		hashtable->innerBatchFile[curbatch] = NULL;
+		pfree(buf.data);
 	}
 
 	/*
@@ -1297,7 +1329,6 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
 	{
 		uint32		hashvalue;
 		MinimalTuple tuple;
-		TupleTableSlot *slot;
 
 		if (!hashtable->batches[batchno].done)
 		{
@@ -1329,12 +1360,9 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
 					while ((tuple = sts_parallel_scan_next(inner_tuples,
 														   &hashvalue)))
 					{
-						ExecForceStoreMinimalTuple(tuple,
-												   hjstate->hj_HashTupleSlot,
-												   false);
-						slot = hjstate->hj_HashTupleSlot;
-						ExecParallelHashTableInsertCurrentBatch(hashtable, slot,
-																hashvalue);
+						ExecParallelHashTableInsertTupleCurrentBatch(hashtable,
+																	 tuple,
+																	 hashvalue);
 					}
 					sts_end_parallel_scan(inner_tuples);
 					BarrierArriveAndWait(batch_barrier,
@@ -1448,14 +1476,14 @@ ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue,
  * ExecHashJoinGetSavedTuple
  *		read the next tuple from a batch file.  Return NULL if no more.
  *
- * On success, *hashvalue is set to the tuple's hash value, and the tuple
- * itself is stored in the given slot.
+ * On success, *hashvalue is set to the tuple's hash value, and return
+ * the tuple(stored in the given buf) itself.
  */
-static TupleTableSlot *
+static MinimalTuple
 ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
 						  BufFile *file,
 						  uint32 *hashvalue,
-						  TupleTableSlot *tupleSlot)
+						  StringInfo buf)
 {
 	uint32		header[2];
 	size_t		nread;
@@ -1474,19 +1502,20 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
 	 * cheating.
 	 */
 	nread = BufFileReadMaybeEOF(file, header, sizeof(header), true);
-	if (nread == 0)				/* end of file */
-	{
-		ExecClearTuple(tupleSlot);
+	if (unlikely(nread == 0))				/* end of file */
 		return NULL;
-	}
+
+	buf->len = 0;	/* inline resetStringInfo(buf); */
+	enlargeStringInfo(buf, header[1]);
+	buf->len = header[1];
 	*hashvalue = header[0];
-	tuple = (MinimalTuple) palloc(header[1]);
+	tuple = (MinimalTuple) buf->data;
 	tuple->t_len = header[1];
 	BufFileReadExact(file,
 					 (char *) tuple + sizeof(uint32),
 					 header[1] - sizeof(uint32));
-	ExecForceStoreMinimalTuple(tuple, tupleSlot, true);
-	return tupleSlot;
+
+	return tuple;
 }
 
 
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index e4eb7bc635..6cc2264692 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -33,15 +33,21 @@ extern void ExecHashTableDetachBatch(HashJoinTable hashtable);
 extern void ExecParallelHashTableSetCurrentBatch(HashJoinTable hashtable,
 												 int batchno);
 
-extern void ExecHashTableInsert(HashJoinTable hashtable,
-								TupleTableSlot *slot,
-								uint32 hashvalue);
+extern void ExecHashTableInsertSlot(HashJoinTable hashtable,
+									TupleTableSlot *slot,
+									uint32 hashvalue);
+extern void ExecHashTableInsertTuple(HashJoinTable hashtable,
+									 MinimalTuple tuple,
+									 uint32 hashvalue);
 extern void ExecParallelHashTableInsert(HashJoinTable hashtable,
 										TupleTableSlot *slot,
 										uint32 hashvalue);
-extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable,
-													TupleTableSlot *slot,
-													uint32 hashvalue);
+extern void ExecParallelHashTableInsertSlotCurrentBatch(HashJoinTable hashtable,
+														TupleTableSlot *slot,
+														uint32 hashvalue);
+extern void ExecParallelHashTableInsertTupleCurrentBatch(HashJoinTable hashtable,
+														 MinimalTuple tuple,
+														 uint32 hashvalue);
 extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable,
 									  uint32 hashvalue,
 									  int *bucketno,
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index af7d8fd1e7..299f66af13 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -2225,6 +2225,7 @@ typedef struct HashJoinState
 	TupleTableSlot *hj_NullOuterTupleSlot;
 	TupleTableSlot *hj_NullInnerTupleSlot;
 	TupleTableSlot *hj_FirstOuterTupleSlot;
+	StringInfo	hj_outerTupleBuffer;
 	int			hj_JoinState;
 	bool		hj_MatchedOuter;
 	bool		hj_OuterNotEmpty;


^ permalink  raw  reply  [nested|flat] 70+ messages in thread


end of thread, other threads:[~2024-08-22 12:08 UTC | newest]

Thread overview: 70+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 01:54 [PATCH 5/7] fix Tomas Vondra <[email protected]>
2020-03-19 02:02 [PATCH 7/7] fix Tomas Vondra <[email protected]>
2020-06-15 10:28 [PATCH 2/3] fix Your Name <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-08-01 02:24 [PATCH 2/2] fix Justin Pryzby <[email protected]>
2020-12-12 17:42 [PATCH v34 2/8] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-01-10 21:41 [PATCH] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2021-03-13 21:51 [PATCH 2/3] fix Justin Pryzby <[email protected]>
2024-08-22 12:08 Re: optimize hashjoin bucoo <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox