mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Pass ItemPointer not HeapTuple to IndexBuildCallback.
Not all AMs use HeapTuples internally, making it inconvenient to pass a HeapTuple. As the index callbacks really only need the TID, not the full tuple, modify callback to only take ItemPointer. Author: Ashwin Agrawal Reviewed-By: Andres Freund Discussion: https://postgr.es/m/CALfoeis6=8ehuR=VNtHvj3z16cYfCwPdTcpaxU+sfSUJ5QgR3g@mail.gmail.com
This commit is contained in:
		@@ -40,7 +40,7 @@ typedef struct
 | 
			
		||||
 | 
			
		||||
/* Callback to process one heap tuple during table_index_build_scan */
 | 
			
		||||
static void
 | 
			
		||||
spgistBuildCallback(Relation index, HeapTuple htup, Datum *values,
 | 
			
		||||
spgistBuildCallback(Relation index, ItemPointer tid, Datum *values,
 | 
			
		||||
					bool *isnull, bool tupleIsAlive, void *state)
 | 
			
		||||
{
 | 
			
		||||
	SpGistBuildState *buildstate = (SpGistBuildState *) state;
 | 
			
		||||
@@ -55,7 +55,7 @@ spgistBuildCallback(Relation index, HeapTuple htup, Datum *values,
 | 
			
		||||
	 * lock on some buffer.  So we need to be willing to retry.  We can flush
 | 
			
		||||
	 * any temp data when retrying.
 | 
			
		||||
	 */
 | 
			
		||||
	while (!spgdoinsert(index, &buildstate->spgstate, &htup->t_self,
 | 
			
		||||
	while (!spgdoinsert(index, &buildstate->spgstate, tid,
 | 
			
		||||
						*values, *isnull))
 | 
			
		||||
	{
 | 
			
		||||
		MemoryContextReset(buildstate->tmpCtx);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user