BUG #19934: pg_upgrade can't handle "interesting" user-defined system relation

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #19934: pg_upgrade can't handle "interesting" user-defined system relation
Date: 2026-11-23 21:00:01
Message-ID: 19934-8d089e510459c3f1@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19934
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 19.0
Operating system: Ubuntu 24.04
Description:

A database with the following contents:
echo "CREATE DATABASE regression;
\connect regression
--- Borrowed from src/test/regress/sql/alter_table.sql
CREATE TABLE new_system_table(id serial primary key, othercol text);
ALTER TABLE new_system_table SET SCHEMA pg_catalog;

-- Tables needed for the version-adaptation step
CREATE TABLE brintest (lsncol pg_lsn);
CREATE TABLE tab_core_types (pg_lsn pg_lsn);
CREATE TABLE brintest_multi (lsncol pg_lsn);
CREATE TABLE brintest_bloom (lsncol pg_lsn);
" > /tmp/db18.sql

can't be upgraded from v18, e.g. with:
olddump=/tmp/db18.sql oldinstall=/tmp/pg18 PROVE_TESTS="t/002*" make -s
check -C src/bin/pg_upgrade/
...
# Restoring database schemas in the new cluster
# *failure*
#
# Consult the last few lines of
".../src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata/pg_upgrade_output.d/20261123T215735.050/log/pg_upgrade_dump_16384.log"
for
# the probable cause of the failure.
# Failure, exiting

cat
".../src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata/pg_upgrade_output.d/20261123T215735.050/log/pg_upgrade_dump_16384.log"
...
pg_restore: processing data for table "pg_catalog.pg_shdepend"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3518; 0 0 STATISTICS DATA new_system_table_pkey
(no owner)
pg_restore: error: could not execute query: ERROR: relation
"pg_catalog.new_system_table_pkey" does not exist
Command was: SELECT * FROM pg_catalog.pg_restore_relation_stats(
'version', '180007'::integer,
'schemaname', 'pg_catalog',
'relname', 'new_system_table_pkey',
'relpages', '1'::integer,
'reltuples', '0'::real,
'relallvisible', '0'::integer,
'relallfrozen', '0'::integer
);

An alternative way to reproduce this failure:
sed -i '/^ALTER TABLE new_system_table SET SCHEMA public;$/,/^DROP TABLE
old_system_table;$/d' src/test/regress/sql/alter_table.sql
src/test/regress/expected/alter_table.out
PROVE_TESTS="t/002*" make -s check -C src/bin/pg_upgrade/

allows to pin-point a commit that introduced it: 1fd1bd871.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-23 21:57:52 Re: BUG #19932: `repack (concurrently)` does not work in `psql` with `AUTOCOMMIT` set to `off`
Previous Message Tom Lane 2026-11-23 20:01:13 Re: Duplicate VOLATILE predicates in a WHERE OR clause can change query results