Re: Making type Datum be 8 bytes everywhere

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Making type Datum be 8 bytes everywhere
Date: 2026-12-05 18:02:53
Message-ID: 0918c1c1-4055-4a95-ad7d-1dbac43c15b5@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Based on a discussion in a different mailing list, I've enabled
TestUpgradeXversion on a bunch of my animals, to improve coverage. And
it promptly failed on turaco - which is a 32-bit arm machine (rpi4, to
be precise), when upgrading to 18 -> 19/master.

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=turaco&dt=2026-12-05%2001%3A15%3A19

The exact failure is this:

---
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 7819; 2605 35240 CAST CAST (bigint AS
"public"."int8alias1") (no owner)
pg_restore: error: could not execute query: ERROR: source and target
data types are not physically compatible
Command was: CREATE CAST (bigint AS "public"."int8alias1") WITHOUT FUNCTION;
---

After a bit of digging, I think it's due to this change (2a600a93c7b),
and I'm not sure it's expected / intentional.

The cause is that the "int8alias1" type is created with "LIKE int8", but
that's of course not recorded anywhere. With pg_dump, we only record the
properties (typlen, typbyval, typalign). So when the type is created on
18, it inherits the int8 properties at that time, and pg_dump dumps
those. Then on 19 we get int8 with different properties, but pg_restore
recreates the "int8alias1" type as it was on 18. And the cast fails,
because the parameters do not match.

I've quickly skimmed the thread, and there's a couple places mentioning
pg_upgrade. But all of those are about SP-GiST indexes, so I guess this
failure is not expected?

I'm not sure what we can do about it, at this point. The number of
people running 32-bit systems with custom data types and casts from
built-in types seems pretty small. But who knows?

regards

--
Tomas Vondra

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Raja Sai pranav 2026-12-05 18:06:30 Re: Incremental backup inconsistency after vacuum truncation + COPY regrowth
Previous Message shihao zhong 2026-12-05 17:51:02 Re: Snapshot export on a standby corrupts hint bits on subxact overflow