Skip to content

Commit

Permalink
Fixed #1803: Postgres ERROR: must be superuser to create a base type …
Browse files Browse the repository at this point in the history
…during clean of DOMAIN
  • Loading branch information
Axel Fontaine committed May 28, 2018
1 parent 6500563 commit 53b61dc
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -157,10 +157,11 @@ private List<String> generateDropStatementsForBaseTypes(boolean recreate) throws
jdbcTemplate.queryForList(
"select typname, typcategory from pg_catalog.pg_type t "
+ "left join pg_depend dep on dep.objid = t.oid and dep.deptype = 'e' "
+ "where (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid)) and "
+ "NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid) and "
+ "t.typnamespace in (select oid from pg_catalog.pg_namespace where nspname = ?) and "
+ "dep.objid is null",
+ "where (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid)) "
+ "and NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid) "
+ "and t.typnamespace in (select oid from pg_catalog.pg_namespace where nspname = ?) "
+ "and dep.objid is null "
+ "and t.typtype != 'd'",
name);

List<String> statements = new ArrayList<>();
Expand Down

0 comments on commit 53b61dc

Please sign in to comment.