| From: | John Naylor <john(dot)naylor(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: pg_upgrade: Check for arrays over system types with auto-assigne |
| Date: | 2026-09-22 06:56:55 |
| Message-ID: | E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
pg_upgrade: Check for arrays over system types with auto-assigned OIDs
Array values embed their element type's OID, and pg_upgrade does not
rewrite user data. The OIDs of information_schema domains can vary
between major versions, so a stored array over one (e.g. by aggregating
an information_schema query into a table) comes through the upgrade
with at best a dangling element OID. Whole-array reads and pg_dump
of the upgraded cluster then fail with "cache lookup failed for type
N". Worst case, the OID has been reassigned, leading to values being
misread instead.
The data type checks miss this because nothing flags the domain itself:
domain storage is just the base type, so the recursive expansion in
data_type_check_query() never reaches the array type.
Add a check for arrays whose element type OID was assigned by genbki.pl
or initdb, including anything in information_schema in case it was
dropped and reloaded.
The scenarios that hit this are fairly contrived, which probably
explains the lack of field reports, so no backpatch for now.
Reviewed-by: Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>
Discussion: https://postgr.es/m/CANWCAZbusXHWWSq_9NpxtOGvR=M5MH4Uj+wO0f1_rtC0uMeSWg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/77f54eb07488341025073a370f6e381a6ee05e04
Modified Files
--------------
src/bin/pg_upgrade/check.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-09-22 10:12:38 | pgsql: Update .abi-compliance-history for parallel GIN index build fix |
| Previous Message | Tom Lane | 2026-09-21 19:16:06 | pgsql: Stamp 19beta4. |