aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-11-26 23:26:05 -0800
committerAndres Freund <andres@anarazel.de>2018-11-26 23:26:05 -0800
commit4c8750a9cc3402e4d8ec0b47901c2f9ca416b718 (patch)
tree35cd78828c2c6b120b804ccdbd2682476b873703
parentac218aa4f6dff6dfb4bf2675b2d9f2f23da6a7c5 (diff)
downloadpostgresql-4c8750a9cc3402e4d8ec0b47901c2f9ca416b718.tar.gz
postgresql-4c8750a9cc3402e4d8ec0b47901c2f9ca416b718.zip
Fix ac218aa4f6 to work on versions before 9.5.
Unfortunately ac218aa4f6 missed the fact that a reference to 'pg_catalog.regnamespace'::regclass wouldn't work before that type is known. Fix that, by replacing the regtype usage with a join to pg_type. Reported-By: Tom Lane Author: Andres Freund Discussion: https://postgr.es/m/8863.1543297423@sss.pgh.pa.us Backpatch: 9.5-, like ac218aa4f6
-rw-r--r--src/bin/pg_upgrade/check.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index 38fc7c26046..f2215b7095d 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -1011,18 +1011,23 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
"SELECT n.nspname, c.relname, a.attname "
"FROM pg_catalog.pg_class c, "
" pg_catalog.pg_namespace n, "
- " pg_catalog.pg_attribute a "
+ " pg_catalog.pg_attribute a, "
+ " pg_catalog.pg_type t "
"WHERE c.oid = a.attrelid AND "
" NOT a.attisdropped AND "
- " a.atttypid IN ( "
+ " a.atttypid = t.oid AND "
+ " t.typnamespace = "
+ " (SELECT oid FROM pg_namespace "
+ " WHERE nspname = 'pg_catalog') AND"
+ " t.typname IN ( "
/* regclass.oid is preserved, so 'regclass' is OK */
- " 'pg_catalog.regconfig'::pg_catalog.regtype, "
- " 'pg_catalog.regdictionary'::pg_catalog.regtype, "
- " 'pg_catalog.regnamespace'::pg_catalog.regtype, "
- " 'pg_catalog.regoper'::pg_catalog.regtype, "
- " 'pg_catalog.regoperator'::pg_catalog.regtype, "
- " 'pg_catalog.regproc'::pg_catalog.regtype, "
- " 'pg_catalog.regprocedure'::pg_catalog.regtype "
+ " 'regconfig', "
+ " 'regdictionary', "
+ " 'regnamespace', "
+ " 'regoper', "
+ " 'regoperator', "
+ " 'regproc', "
+ " 'regprocedure' "
/* regrole.oid is preserved, so 'regrole' is OK */
/* regtype.oid is preserved, so 'regtype' is OK */
" ) AND "