Re: Abbreviated keys for Numeric - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Abbreviated keys for Numeric
Date
Msg-id 5410.1428088014@sss.pgh.pa.us
Whole thread Raw
In response to Re: Abbreviated keys for Numeric  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Abbreviated keys for Numeric
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Apr 3, 2015 at 1:39 PM, Andrew Gierth
> <andrew@tao11.riddles.org.uk> wrote:
>> If you're determined to go this route - over my protest - then you need
>> to do something like define a NumericAbbrevGetDatum(x) macro and use it
>> in place of the Int64GetDatum / Int32GetDatum ones for both NAN and the
>> return from numeric_abbrev_convert_var.

> Patch for that attached.

FWIW, I think it's sensible to define NumericAbbrevGetDatum and the
converse, but I'd suggest you just do it like

#define NumericAbbrevGetDatum(X) Int64GetDatum(X)
or
#define NumericAbbrevGetDatum(X) Int32GetDatum(X)

I'm not especially a fan of reaching inside the GetDatum macros when
you don't have to.  And the code that's calling these certainly knows
that it's supplying an int64 or int32 respectively.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Abbreviated keys for Numeric
Next
From: Tom Lane
Date:
Subject: Re: Abbreviated keys for Numeric