Re: Time to drop old-style (V0) functions?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Time to drop old-style (V0) functions?
Date: 2017-03-27 14:10:36
Message-ID: 17102.1490623836@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Craig Ringer <craig(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2017-03-27 14:11:18 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Previous Message Robert Haas 2017-03-27 14:00:47 Re: standardized backwards incompatibility tag for commits