Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81e11f2

Browse files
committed
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" reallymeans a pointer anyway.
1 parent03e5248 commit81e11f2

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

‎src/backend/utils/adt/array_userfuncs.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003-2008, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.25 2008/11/1400:12:08 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.26 2008/11/1402:09:51 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -495,14 +495,10 @@ array_agg_transfn(PG_FUNCTION_ARGS)
495495
((AggState*)fcinfo->context)->aggcontext);
496496

497497
/*
498-
* We cheat quite a lot here by assuming that a pointer datum will be
499-
* preserved intact when nodeAgg.c thinks it is a value of type "internal".
500-
* This will in fact work because internal is stated to be pass-by-value
501-
* in pg_type.h, and nodeAgg will never do anything with a pass-by-value
502-
* transvalue except pass it around in Datum form. But it's mighty
503-
* shaky seeing that internal is also stated to be 4 bytes wide in
504-
* pg_type.h. If nodeAgg did put the value into a tuple this would
505-
* crash and burn on 64-bit machines.
498+
* The transition type for array_agg() is declared to be "internal",
499+
* which is a pass-by-value type the same size as a pointer. So we
500+
* can safely pass the ArrayBuildState pointer through nodeAgg.c's
501+
* machinations.
506502
*/
507503
PG_RETURN_POINTER(state);
508504
}

‎src/bin/initdb/initdb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.163 2008/10/31 07:15:11 petere Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.164 2008/11/14 02:09:51 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1331,6 +1331,12 @@ bootstrap_template1(char *short_version)
13311331
sprintf(buf,"%d",NAMEDATALEN);
13321332
bki_lines=replace_token(bki_lines,"NAMEDATALEN",buf);
13331333

1334+
sprintf(buf,"%d", (int)sizeof(Pointer));
1335+
bki_lines=replace_token(bki_lines,"SIZEOF_POINTER",buf);
1336+
1337+
bki_lines=replace_token(bki_lines,"ALIGNOF_POINTER",
1338+
(sizeof(Pointer)==4) ?"i" :"d");
1339+
13341340
bki_lines=replace_token(bki_lines,"FLOAT4PASSBYVAL",
13351341
FLOAT4PASSBYVAL ?"true" :"false");
13361342

‎src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.506 2008/11/1400:51:46 tgl Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.507 2008/11/1402:09:51 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO200811132
56+
#defineCATALOG_VERSION_NO200811133
5757

5858
#endif

‎src/include/catalog/pg_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.201 2008/10/13 16:25:20 tgl Exp $
11+
* $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.202 2008/11/14 02:09:52 tgl Exp $
1212
*
1313
* NOTES
1414
* the genbki.sh script reads this file and generates .bki
@@ -613,7 +613,7 @@ DATA(insert OID = 2279 ( triggerPGNSP PGUID 4 t p P f t \054 0 0 0 trigger_in
613613
#defineTRIGGEROID2279
614614
DATA(insertOID=2280 (language_handlerPGNSPPGUID4tpPft \054000language_handler_inlanguage_handler_out-----ipf0-10_null__null_ ));
615615
#defineLANGUAGE_HANDLEROID2280
616-
DATA(insertOID=2281 (internalPGNSPPGUID4tpPft \054000internal_ininternal_out-----ipf0-10_null__null_ ));
616+
DATA(insertOID=2281 (internalPGNSPPGUIDSIZEOF_POINTERtpPft \054000internal_ininternal_out-----ALIGNOF_POINTERpf0-10_null__null_ ));
617617
#defineINTERNALOID2281
618618
DATA(insertOID=2282 (opaquePGNSPPGUID4tpPft \054000opaque_inopaque_out-----ipf0-10_null__null_ ));
619619
#defineOPAQUEOID2282

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp