Skip to content

Commit a52c31b

Browse files
committed
Fix ac218aa to work on versions before 9.5.
Unfortunately ac218aa 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 ac218aa
1 parent 17024c0 commit a52c31b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -905,18 +905,23 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
905905
"SELECT n.nspname, c.relname, a.attname "
906906
"FROM pg_catalog.pg_class c, "
907907
" pg_catalog.pg_namespace n, "
908-
" pg_catalog.pg_attribute a "
908+
" pg_catalog.pg_attribute a, "
909+
" pg_catalog.pg_type t "
909910
"WHERE c.oid = a.attrelid AND "
910911
" NOT a.attisdropped AND "
911-
" a.atttypid IN ( "
912+
" a.atttypid = t.oid AND "
913+
" t.typnamespace = "
914+
" (SELECT oid FROM pg_namespace "
915+
" WHERE nspname = 'pg_catalog') AND"
916+
" t.typname IN ( "
912917
/* regclass.oid is preserved, so 'regclass' is OK */
913-
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
914-
" 'pg_catalog.regdictionary'::pg_catalog.regtype, "
915-
" 'pg_catalog.regnamespace'::pg_catalog.regtype, "
916-
" 'pg_catalog.regoper'::pg_catalog.regtype, "
917-
" 'pg_catalog.regoperator'::pg_catalog.regtype, "
918-
" 'pg_catalog.regproc'::pg_catalog.regtype, "
919-
" 'pg_catalog.regprocedure'::pg_catalog.regtype "
918+
" 'regconfig', "
919+
" 'regdictionary', "
920+
" 'regnamespace', "
921+
" 'regoper', "
922+
" 'regoperator', "
923+
" 'regproc', "
924+
" 'regprocedure' "
920925
/* regrole.oid is preserved, so 'regrole' is OK */
921926
/* regtype.oid is preserved, so 'regtype' is OK */
922927
" ) AND "

0 commit comments

Comments
 (0)