Re: Time to drop old-style (V0) functions? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Time to drop old-style (V0) functions?
Date
Msg-id 17102.1490623836@sss.pgh.pa.us
Whole thread Raw
In response to Time to drop old-style (V0) functions?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Craig Ringer <craig@2ndquadrant.com> writes:
> I didn't have any way to make

>                 seg_l = (SEG *) DatumGetPointer(DirectFunctionCall2(seg_union,
>                         PointerGetDatum(seg_l),
> PointerGetDatum(sort_items[i].data)));

> pretty, but *shrug*.

For the builtin types, fmgr.h generally defines a datum-to-specific-
pointer-type macro, eg it has these for bytea:

#define DatumGetByteaP(X)           ((bytea *) PG_DETOAST_DATUM(X))
#define PG_GETARG_BYTEA_P(n)        DatumGetByteaP(PG_GETARG_DATUM(n))

(A type that doesn't have toast support would just use DatumGetPointer
instead of PG_DETOAST_DATUM.)  Replacing "(SEG *) DatumGetPointer(...)"
with "DatumGetSegP(...)" would help a little here.

I wouldn't necessarily do that if this is the only place that would
benefit, but there might be more scope for upgrading seg.c's notation
than just here.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: standardized backwards incompatibility tag for commits
Next
From: Corey Huinker
Date:
Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)