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

Commit 5ef8f08

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 203a909 commit 5ef8f08

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
@@ -915,18 +915,23 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
915915
"SELECT n.nspname, c.relname, a.attname "
916916
"FROM pg_catalog.pg_class c, "
917917
" pg_catalog.pg_namespace n, "
918-
" pg_catalog.pg_attribute a "
918+
" pg_catalog.pg_attribute a, "
919+
" pg_catalog.pg_type t "
919920
"WHERE c.oid = a.attrelid AND "
920921
" NOT a.attisdropped AND "
921-
" a.atttypid IN ( "
922+
" a.atttypid = t.oid AND "
923+
" t.typnamespace = "
924+
" (SELECT oid FROM pg_namespace "
925+
" WHERE nspname = 'pg_catalog') AND"
926+
" t.typname IN ( "
922927
/* regclass.oid is preserved, so 'regclass' is OK */
923-
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
924-
" 'pg_catalog.regdictionary'::pg_catalog.regtype, "
925-
" 'pg_catalog.regnamespace'::pg_catalog.regtype, "
926-
" 'pg_catalog.regoper'::pg_catalog.regtype, "
927-
" 'pg_catalog.regoperator'::pg_catalog.regtype, "
928-
" 'pg_catalog.regproc'::pg_catalog.regtype, "
929-
" 'pg_catalog.regprocedure'::pg_catalog.regtype "
928+
" 'regconfig', "
929+
" 'regdictionary', "
930+
" 'regnamespace', "
931+
" 'regoper', "
932+
" 'regoperator', "
933+
" 'regproc', "
934+
" 'regprocedure' "
930935
/* regrole.oid is preserved, so 'regrole' is OK */
931936
/* regtype.oid is preserved, so 'regtype' is OK */
932937
" ) AND "

0 commit comments

Comments
 (0)