How to fix, issue while pushing the migration, drizzle is treating view as table and trying to drop
pgPush fails with “pg_stat_statements_info is not a table” error
While applying the migration and pushing the migration using
It looks like Drizzle is trying to drop pg_stat_statements_info as if it were a table, but it’s actually a view provided by the pg_stat_statements extension. I haven’t configured anything special in drizzle.config.ts, so I expected introspection to skip system views or at least use the proper DROP VIEW syntax.
What I’ve tried so far
- Manually disabling or ignoring system schemas/tables in drizzle.config.ts (no effect)
- Tried by adding view in schema witht he
- Confirming that the view exists by running \dv pg_stat_statements_info in psql
Questions
- Is there a recommended way to tell Drizzle to ignore Postgres system views (like anything in pg_catalog or provided by an extension)?
- If not, is there a workaround so that drizzle-kit push uses DROP VIEW instead of DROP TABLE for views?
- Would it make sense for Drizzle to automatically detect views vs. tables during introspection?
Thanks in advance for any guidance! Happy to share more config or logs if helpful.
While applying the migration and pushing the migration using
drizzle-kit push facing below issue, drizzle is trying to It looks like Drizzle is trying to drop pg_stat_statements_info as if it were a table, but it’s actually a view provided by the pg_stat_statements extension. I haven’t configured anything special in drizzle.config.ts, so I expected introspection to skip system views or at least use the proper DROP VIEW syntax.
What I’ve tried so far
- Manually disabling or ignoring system schemas/tables in drizzle.config.ts (no effect)
- Tried by adding view in schema witht he
existing() but no effect.- Confirming that the view exists by running \dv pg_stat_statements_info in psql
Questions
- Is there a recommended way to tell Drizzle to ignore Postgres system views (like anything in pg_catalog or provided by an extension)?
- If not, is there a workaround so that drizzle-kit push uses DROP VIEW instead of DROP TABLE for views?
- Would it make sense for Drizzle to automatically detect views vs. tables during introspection?
Thanks in advance for any guidance! Happy to share more config or logs if helpful.
