Re: improve type conversion of SPI_processed in Python - Mailing list pgsql-hackers

From Tom Lane
Subject Re: improve type conversion of SPI_processed in Python
Date
Msg-id 7682.1515773182@sss.pgh.pa.us
Whole thread Raw
In response to Re: improve type conversion of SPI_processed in Python  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: improve type conversion of SPI_processed in Python
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Next
From: Corey Huinker
Date:
Subject: Re: CREATE ROUTINE MAPPING