8000 Fix new pg_upgrade query not to rely on regnamespace · postgres/postgres@7084692 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 7084692

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 b0f0e22 commit 7084692

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
@@ -1059,12 +1059,13 @@ check_for_not_null_inheritance(ClusterInfo *cluster)
10591059
PGconn *conn = connectToServer(&old_cluster, active_db->db_name);
10601060

10611061
res = executeQueryOrDie(conn,
1062-
"SELECT cc.relnamespace::pg_catalog.regnamespace AS nspname, "
1063-
" cc.relname, ac.attname "
1062+
"SELECT nspname, cc.relname, ac.attname "
10641063
"FROM pg_catalog.pg_inherits i, pg_catalog.pg_attribute ac, "
1065-
& 630F quot; pg_catalog.pg_attribute ap, pg_catalog.pg_class cc "
1064+
" pg_catalog.pg_attribute ap, pg_catalog.pg_class cc, "
1065+
" pg_catalog.pg_namespace nc "
10661066
"WHERE cc.oid = ac.attrelid AND i.inhrelid = ac.attrelid "
10671067
" AND i.inhparent = ap.attrelid AND ac.attname = ap.attname "
1068+
" AND cc.relnamespace = nc.oid "
10681069
" AND ap.attnum > 0 and ap.attnotnull AND NOT ac.attnotnull");
10691070

10701071
ntup = PQntuples(res);

0 commit comments

Comments
 (0)
0