Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4c8750a

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 ac218aa commit 4c8750a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/bin/pg_upgrade/check.c

+14-9
Original file line numberDiff line numberDiff line change
@@ -1011,18 +1011,23 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
10111011
"SELECT n.nspname, c.relname, a.attname "
10121012
"FROM pg_catalog.pg_class c, "
10131013
" pg_catalog.pg_namespace n, "
1014-
" pg_catalog.pg_attribute a "
1014+
" pg_catalog.pg_attribute a, "
1015+
" pg_catalog.pg_type t "
10151016
"WHERE c.oid = a.attrelid AND "
10161017
" NOT a.attisdropped AND "
1017-
" a.atttypid IN ( "
1018+
" a.atttypid = t.oid AND "
1019+
" t.typnamespace = "
1020+
" (SELECT oid FROM pg_namespace "
1021+
" WHERE nspname = 'pg_catalog') AND"
1022+
" t.typname IN ( "
10181023
/* regclass.oid is preserved, so 'regclass' is OK */
1019-
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
1020-
" 'pg_catalog.regdictionary'::pg_catalog.regtype, "
1021-
" 'pg_catalog.regnamespace'::pg_catalog.regtype, "
1022-
" 'pg_catalog.regoper'::pg_catalog.regtype, "
1023-
" 'pg_catalog.regoperator'::pg_catalog.regtype, "
1024-
" 'pg_catalog.regproc'::pg_catalog.regtype, "
1025-
" 'pg_catalog.regprocedure'::pg_catalog.regtype "
1024+
" 'regconfig', "
1025+
" 'regdictionary', "
1026+
" 'regnamespace', "
1027+
" 'regoper', "
1028+
" 'regoperator', "
1029+
" 'regproc', "
1030+
" 'regprocedure' "
10261031
/* regrole.oid is preserved, so 'regrole' is OK */
10271032
/* regtype.oid is preserved, so 'regtype' is OK */
10281033
" ) AND "

0 commit comments

Comments
 (0)