mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Remove unnecessary coziness of GIN code with datum copying. Now that
space is tracked via GetMemoryChunkSpace, there's really no advantage to duplicating datumCopy's innards here. This is one bit of my toast indirection patch that should go in anyway.
This commit is contained in:
parent
4a8d573cda
commit
7ea9b997ef
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.11 2008/01/01 19:45:46 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.12 2008/06/29 21:04:01 tgl Exp $
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -78,8 +78,8 @@ ginInsertData(BuildAccumulator *accum, EntryAccumulator *entry, ItemPointer heap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is basically the same as datumCopy(), but we duplicate some code
|
* This is basically the same as datumCopy(), but modified to count
|
||||||
* to avoid computing the datum size twice.
|
* palloc'd space in accum.
|
||||||
*/
|
*/
|
||||||
static Datum
|
static Datum
|
||||||
getDatumCopy(BuildAccumulator *accum, Datum value)
|
getDatumCopy(BuildAccumulator *accum, Datum value)
|
||||||
@ -91,16 +91,8 @@ getDatumCopy(BuildAccumulator *accum, Datum value)
|
|||||||
res = value;
|
res = value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Size realSize;
|
res = datumCopy(value, false, att[0]->attlen);
|
||||||
char *s;
|
accum->allocatedMemory += GetMemoryChunkSpace(DatumGetPointer(res));
|
||||||
|
|
||||||
realSize = datumGetSize(value, false, att[0]->attlen);
|
|
||||||
|
|
||||||
s = (char *) palloc(realSize);
|
|
||||||
accum->allocatedMemory += GetMemoryChunkSpace(s);
|
|
||||||
|
|
||||||
memcpy(s, DatumGetPointer(value), realSize);
|
|
||||||
res = PointerGetDatum(s);
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user