pgaio_io_get_id() type (was Re: Datum as struct)

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Date: 2025-08-05T17:20:20Z
Lists: pgsql-hackers

Attachments

On 31.07.25 19:17, Tom Lane wrote:
> Also I see a "// XXX" in pg_get_aios, which I guess is a note
> to confirm the data type to use for ioh_id?

Yes, the stuff returned from pgaio_io_get_id() should be int, but some 
code uses uint32, and also UINT32_MAX as a special marker.  Here is a 
patch that tries to straighten that out by using int consistently and -1 
as a special marker.

Commits

  1. Use consistent type for pgaio_io_get_id() result

  2. Mop-up for Datum conversion cleanups.

  3. Add missing Datum conversions

  4. Remove useless/superfluous Datum conversions

  5. Fix incorrect lack of Datum conversion in _int_matchsel()

  6. Improve tests of date_trunc() with infinity and unsupported units

  7. Fix incorrect Datum conversion in timestamptz_trunc_internal()

  8. Fix various hash function uses

  9. Fix mixups of FooGetDatum() vs. DatumGetFoo()