Re: Improper use about DatumGetInt32
| От | Tom Lane |
|---|---|
| Тема | Re: Improper use about DatumGetInt32 |
| Дата | |
| Msg-id | 1310787.1600805461@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Improper use about DatumGetInt32 (Robert Haas <robertmhaas@gmail.com>) |
| Ответы |
Re: Improper use about DatumGetInt32
|
| Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Sep 21, 2020 at 3:53 PM Andres Freund <andres@anarazel.de> wrote:
>> I think we mostly use it for the few places where we currently expose
>> data as a signed integer on the SQL level, but internally actually treat
>> it as a unsigned data.
> So why is the right solution to that not DatumGetInt32() + a cast to uint32?
You're ignoring the xid use-case, for which DatumGetUInt32 actually is
the right thing. I tend to agree though that if the SQL argument is
of a signed type, the least API-abusing answer is a signed DatumGetXXX
macro followed by whatever cast you need.
regards, tom lane
В списке pgsql-hackers по дате отправления: