Actually, instead of whining about how type internal might not safely store
a pointer, why don't we just fix that. Every known use of "internal" really means a pointer anyway.
This commit is contained in:
parent
03e5248d0f
commit
81e11f2d05
src
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 2003-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.25 2008/11/14 00:12:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.26 2008/11/14 02:09:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -495,14 +495,10 @@ array_agg_transfn(PG_FUNCTION_ARGS)
|
||||
((AggState *) fcinfo->context)->aggcontext);
|
||||
|
||||
/*
|
||||
* We cheat quite a lot here by assuming that a pointer datum will be
|
||||
* preserved intact when nodeAgg.c thinks it is a value of type "internal".
|
||||
* This will in fact work because internal is stated to be pass-by-value
|
||||
* in pg_type.h, and nodeAgg will never do anything with a pass-by-value
|
||||
* transvalue except pass it around in Datum form. But it's mighty
|
||||
* shaky seeing that internal is also stated to be 4 bytes wide in
|
||||
* pg_type.h. If nodeAgg did put the value into a tuple this would
|
||||
* crash and burn on 64-bit machines.
|
||||
* The transition type for array_agg() is declared to be "internal",
|
||||
* which is a pass-by-value type the same size as a pointer. So we
|
||||
* can safely pass the ArrayBuildState pointer through nodeAgg.c's
|
||||
* machinations.
|
||||
*/
|
||||
PG_RETURN_POINTER(state);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
* Portions taken from FreeBSD.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.163 2008/10/31 07:15:11 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.164 2008/11/14 02:09:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1331,6 +1331,12 @@ bootstrap_template1(char *short_version)
|
||||
sprintf(buf, "%d", NAMEDATALEN);
|
||||
bki_lines = replace_token(bki_lines, "NAMEDATALEN", buf);
|
||||
|
||||
sprintf(buf, "%d", (int) sizeof(Pointer));
|
||||
bki_lines = replace_token(bki_lines, "SIZEOF_POINTER", buf);
|
||||
|
||||
bki_lines = replace_token(bki_lines, "ALIGNOF_POINTER",
|
||||
(sizeof(Pointer) == 4) ? "i" : "d");
|
||||
|
||||
bki_lines = replace_token(bki_lines, "FLOAT4PASSBYVAL",
|
||||
FLOAT4PASSBYVAL ? "true" : "false");
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.506 2008/11/14 00:51:46 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.507 2008/11/14 02:09:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 200811132
|
||||
#define CATALOG_VERSION_NO 200811133
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.201 2008/10/13 16:25:20 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.202 2008/11/14 02:09:52 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
@ -613,7 +613,7 @@ DATA(insert OID = 2279 ( trigger PGNSP PGUID 4 t p P f t \054 0 0 0 trigger_in
|
||||
#define TRIGGEROID 2279
|
||||
DATA(insert OID = 2280 ( language_handler PGNSP PGUID 4 t p P f t \054 0 0 0 language_handler_in language_handler_out - - - - - i p f 0 -1 0 _null_ _null_ ));
|
||||
#define LANGUAGE_HANDLEROID 2280
|
||||
DATA(insert OID = 2281 ( internal PGNSP PGUID 4 t p P f t \054 0 0 0 internal_in internal_out - - - - - i p f 0 -1 0 _null_ _null_ ));
|
||||
DATA(insert OID = 2281 ( internal PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 internal_in internal_out - - - - - ALIGNOF_POINTER p f 0 -1 0 _null_ _null_ ));
|
||||
#define INTERNALOID 2281
|
||||
DATA(insert OID = 2282 ( opaque PGNSP PGUID 4 t p P f t \054 0 0 0 opaque_in opaque_out - - - - - i p f 0 -1 0 _null_ _null_ ));
|
||||
#define OPAQUEOID 2282
|
||||
|
Loading…
x
Reference in New Issue
Block a user