From 81e11f2d056c7966ce6ae54f41026434e2eb3b28 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 14 Nov 2008 02:09:52 +0000 Subject: 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. --- src/backend/utils/adt/array_userfuncs.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/backend/utils/adt/array_userfuncs.c') diff --git a/src/backend/utils/adt/array_userfuncs.c b/src/backend/utils/adt/array_userfuncs.c index 6f18c664059..4c147f0021d 100644 --- a/src/backend/utils/adt/array_userfuncs.c +++ b/src/backend/utils/adt/array_userfuncs.c @@ -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); } -- cgit v1.2.3