Skip to content

Commit d275551

Browse files
committed
Filter information_schema, pg_catalog from views
Dumping views was failing because it was including views from the internal information_schema and pg_catalog schemas. Filter them to ensure we only get views we defined. https://neon.tech/postgresql/postgresql-views/postgresql-list-views
1 parent 64d82b0 commit d275551

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/spectacles/schema_statements/postgresql_adapter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def views(name = nil) # :nodoc:
1111
FROM information_schema.views AS t
1212
INNER JOIN pg_class AS c ON c.relname = t.table_name AND c.relnamespace = to_regnamespace(t.table_schema)::oid
1313
WHERE t.table_schema = ANY(current_schemas(true))
14+
AND table_schema NOT IN ('information_schema', 'pg_catalog')
1415
AND pg_catalog.pg_get_userbyid(c.relowner) = #{quote(database_username)}
1516
SQL
1617

0 commit comments

Comments
 (0)