Content-Length: 312308 | pFad | http://github.com/postgrespro/postgres/commit/7ea9b997ef07672d45278ab1c5b0634eaa090966

32 Remove unnecessary coziness of GIN code with datum copying. Now that · postgrespro/postgres@7ea9b99 · GitHub
Skip to content

Commit 7ea9b99

Browse files
committed
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.
1 parent 4a8d573 commit 7ea9b99

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/backend/access/gin/ginbulk.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.11 2008/01/01 19:45:46 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.12 2008/06/29 21:04:01 tgl Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414

@@ -78,8 +78,8 @@ ginInsertData(BuildAccumulator *accum, EntryAccumulator *entry, ItemPointer heap
7878
}
7979

8080
/*
81-
* This is basically the same as datumCopy(), but we duplicate some code
82-
* to avoid computing the datum size twice.
81+
* This is basically the same as datumCopy(), but modified to count
82+
* palloc'd space in accum.
8383
*/
8484
static Datum
8585
getDatumCopy(BuildAccumulator *accum, Datum value)
@@ -91,16 +91,8 @@ getDatumCopy(BuildAccumulator *accum, Datum value)
9191
res = value;
9292
else
9393
{
94-
Size realSize;
95-
char *s;
96-
97-
realSize = datumGetSize(value, false, att[0]->attlen);
98-
99-
s = (char *) palloc(realSize);
100-
accum->allocatedMemory += GetMemoryChunkSpace(s);
101-
102-
memcpy(s, DatumGetPointer(value), realSize);
103-
res = PointerGetDatum(s);
94+
res = datumCopy(value, false, att[0]->attlen);
95+
accum->allocatedMemory += GetMemoryChunkSpace(DatumGetPointer(res));
10496
}
10597
return res;
10698
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/7ea9b997ef07672d45278ab1c5b0634eaa090966

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy