Re: improve type conversion of SPI_processed in Python

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: improve type conversion of SPI_processed in Python
Date: 2018-01-12 16:06:22
Message-ID: 7682.1515773182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 1/9/18 15:54, Tom Lane wrote:
>> I'd be inclined to code PLyObject_FromUint64() as an exact
>> analog of PLyLong_FromInt64(), ie
>>
>> /* on 32 bit platforms "unsigned long" may be too small */
>> if (sizeof(uint64) > sizeof(unsigned long))
>> return PyLong_FromUnsignedLongLong(DatumGetUInt64(d));
>> else
>> return PyLong_FromUnsignedLong(DatumGetUInt64(d));
>>
>> and let Python worry about how to optimize the conversion.

> Would that even be necessary? Why not use the LongLong variant all the
> time then?

I've not looked at the Python internals to see if one is noticeably faster
than the other, but if it isn't, yeah we could simplify that. In any case
my main point is let's keep these two functions using similar approaches.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2018-01-12 16:11:26 Re: CREATE ROUTINE MAPPING
Previous Message Tom Lane 2018-01-12 16:03:04 Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()