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