Report hasn't been filed before.
What version of drizzle-orm are you using?
1.0.0-beta.13-f728631
What version of drizzle-kit are you using?
1.0.0-beta.13-f728631
Other packages
No response
Describe the Bug
What is the undesired behavior?
When running drizzle-kit push, the tool attempts to drop or modify database objects (specifically policies on cron.job) that reside in schemas explicitly excluded by the schemaFilter configuration.
Even with schemaFilter: ["public"] configured in [drizzle.config.ts], drizzle-kit introspects the cron schema (created by the pg_cron extension) and generates SQL to drop its policies. This results in a permission error because the user does not own the extension-managed objects.
Note 1: Although the documentation states that the default schemaFilter is ["public"], I observed different results when explicitly setting it versus omitting it, suggesting the default might not be applied as expected in this version.
Note 2: The execution halts immediately at the drop policy error on the cron schema. Therefore, I cannot confirm whether other schemas present in the database would also be incorrectly targeted, but it is possible that the issue extends to them as well.
Additionally, attempting to use extensionsFilters as a workaround fails because:
- It seems to be ignored or insufficient to prevent this introspection.
- The TypeScript types for
extensionsFilters are overly restrictive (only allowing "postgis" in our version), creating type errors.
What are the steps to reproduce it?
- Use a PostgreSQL database (e.g., Supabase) with the
pg_cron extension enabled (which creates a cron schema and default policies).
- Configure [drizzle.config.ts] to only manage the
public schema:
export default defineConfig({
schemaFilter: ["public"],
// ... other config
});
- Run
drizzle-kit push.
- Observe that
drizzle-kit generates SQL statements targeting the cron schema, such as:
DROP POLICY "cron_job_policy" ON "cron"."job";
- The command fails with: query error: must be owner of relation job.
What is the desired result?
drizzle-kit should strictly respect the schemaFilter configuration. If schemaFilter is set to ["public"], no other schemas (like cron, auth, storage, etc.) should be introspected, and no SQL should be generated for them, regardless of whether they contain extensions or not.
Environment & Configuration
What database engine are you using? Are you using a specific cloud provider? Which one?
PostgreSQL via Supabase.
Do you think this bug pertains to a specific database driver? Which one?
Likely specific to drizzle-kit's introspection logic on PostgreSQL when extensions are present. We are using postgres (postgres.js) or pg driver, but this occurs at the drizzle-kit push level.
Are you working in a monorepo?
Yes, referencing a shared config in a packages/db workspace.
If this is a bug related to types: What Typescript version are you using?
TypeScript 5.x.
Configuration (drizzle.config.ts):
import { defineConfig } from "drizzle-kit";
export default defineConfig({
out: "./src/drizzle/migrations",
schema: "./src/drizzle/schema.ts",
schemaFilter: ["public"],
// Attempted workaround (failed primarily due to types and lack of effect):
// extensionsFilters: ["postgis", "pg_cron"],
strict: true,
verbose: true,
dialect: "postgresql",
// ... credentials
});
Error Log:
DROP POLICY "cron_job_policy" ON "cron"."job";
--> query error: must be owner of relation job
Report hasn't been filed before.
What version of
drizzle-ormare you using?1.0.0-beta.13-f728631
What version of
drizzle-kitare you using?1.0.0-beta.13-f728631
Other packages
No response
Describe the Bug
What is the undesired behavior?
When running
drizzle-kit push, the tool attempts to drop or modify database objects (specifically policies oncron.job) that reside in schemas explicitly excluded by theschemaFilterconfiguration.Even with
schemaFilter: ["public"]configured in [drizzle.config.ts],drizzle-kitintrospects thecronschema (created by thepg_cronextension) and generates SQL to drop its policies. This results in a permission error because the user does not own the extension-managed objects.Note 1: Although the documentation states that the default
schemaFilteris["public"], I observed different results when explicitly setting it versus omitting it, suggesting the default might not be applied as expected in this version.Note 2: The execution halts immediately at the
drop policyerror on thecronschema. Therefore, I cannot confirm whether other schemas present in the database would also be incorrectly targeted, but it is possible that the issue extends to them as well.Additionally, attempting to use
extensionsFiltersas a workaround fails because:extensionsFiltersare overly restrictive (only allowing"postgis"in our version), creating type errors.What are the steps to reproduce it?
pg_cronextension enabled (which creates acronschema and default policies).publicschema:drizzle-kit push.drizzle-kitgenerates SQL statements targeting thecronschema, such as:What is the desired result?
drizzle-kitshould strictly respect theschemaFilterconfiguration. IfschemaFilteris set to["public"], no other schemas (likecron,auth,storage, etc.) should be introspected, and no SQL should be generated for them, regardless of whether they contain extensions or not.Environment & Configuration
What database engine are you using? Are you using a specific cloud provider? Which one?
PostgreSQL via Supabase.
Do you think this bug pertains to a specific database driver? Which one?
Likely specific to
drizzle-kit's introspection logic on PostgreSQL when extensions are present. We are usingpostgres(postgres.js) orpgdriver, but this occurs at thedrizzle-kit pushlevel.Are you working in a monorepo?
Yes, referencing a shared config in a
packages/dbworkspace.If this is a bug related to types: What Typescript version are you using?
TypeScript 5.x.
Configuration (
drizzle.config.ts):Error Log: