agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_upgrade: Check for arrays over system types with auto-assigne
Date: Tue, 22 Sep 2026 06:56:55 +0000
Message-ID: <E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org> (raw)
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@outlook.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(+)
Message-ID: <E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org>
Permalink: ../E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: john.naylor@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: pg_upgrade: Check for arrays over system types with auto-assigne
In-Reply-To: <E1x8uQx-00000000kCN-1HlH@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox