Re: GiST patches for 7.2 (please apply)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Teodor Sigaev <teodor(at)stack(dot)net>
Subject: Re: GiST patches for 7.2 (please apply)
Date: 2001-08-22 18:44:38
Message-ID: 20335.998505878@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2001-08-22 18:56:06 Re: bugs - lets call an exterminator!
Previous Message Mikhail Terekhov 2001-08-22 18:44:23 libpq.dll & psql.exe on Win32