Skip to content

Commit 144ad72

Browse files
author
Álvaro Herrera
committed
Fix new pg_upgrade query not to rely on regnamespace
That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql
1 parent 90a85fc commit 144ad72

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,12 +1689,13 @@ check_for_not_null_inheritance(ClusterInfo *cluster)
16891689
log_opts.basedir,
16901690
"not_null_inconsistent_columns.txt");
16911691

1692-
query = "SELECT cc.relnamespace::pg_catalog.regnamespace AS nspname, "
1693-
" cc.relname, ac.attname "
1692+
query = "SELECT nspname, cc.relname, ac.attname "
16941693
"FROM pg_catalog.pg_inherits i, pg_catalog.pg_attribute ac, "
1695-
" pg_catalog.pg_attribute ap, pg_catalog.pg_class cc "
1694+
" pg_catalog.pg_attribute ap, pg_catalog.pg_class cc, "
1695+
" pg_catalog.pg_namespace nc "
16961696
"WHERE cc.oid = ac.attrelid AND i.inhrelid = ac.attrelid "
16971697
" AND i.inhparent = ap.attrelid AND ac.attname = ap.attname "
1698+
" AND cc.relnamespace = nc.oid "
16981699
" AND ap.attnum > 0 and ap.attnotnull AND NOT ac.attnotnull";
16991700

17001701
task = upgrade_task_create();

0 commit comments

Comments
 (0)