Re: GiST patches for 7.2 (please apply) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: GiST patches for 7.2 (please apply)
Date
Msg-id 20335.998505878@sss.pgh.pa.us
Whole thread Raw
In response to GiST patches for 7.2 (please apply)  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
Oh, one other comment --- the rtree_gist code had a bunch of functions
declared like

GISTENTRY * gbox_compress(PG_FUNCTION_ARGS);
BOX *gbox_union(PG_FUNCTION_ARGS);
GIST_SPLITVEC * gbox_picksplit(PG_FUNCTION_ARGS);
bool gbox_consistent(PG_FUNCTION_ARGS);
float * gbox_penalty(PG_FUNCTION_ARGS);
bool * gbox_same(PG_FUNCTION_ARGS);

This is not portable.  The declaration of any V1-style fmgr-callable
function must be exactly

Datum foo(PG_FUNCTION_ARGS);

no more and no less.  You can't shortcut by assuming that pointers are
the same size as Datum, or that bool is the same size as Datum, or that
the generated machine code will be the same anyway.  (There are machines
that have different register conventions for returning pointers and
integers, even though they're the same size.)  If you're going to put up
with the notational cruft of the V1 calling convention for arguments,
don't blow the portability advantages by not doing it for results too.

I fixed this in rtree_gist.c, but did not look to see if similar
problems exist elsewhere.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: GiST patches for 7.2 (please apply)
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: List response time...