Skip to content

dbt-materialize: quote the schema when copying default privileges - #38191

Merged
def- merged 1 commit into
MaterializeInc:mainfrom
def-:dbt-deploy-init-quote-default-privs
Aug 13, 2026
Merged

def- merged 1 commit into
MaterializeInc:mainfrom
def-:dbt-deploy-init-quote-default-privs

Conversation

@def-

@def- def- commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

internal_copy_schema_default_privs interpolated the target schema name raw into ALTER DEFAULT PRIVILEGES ... IN SCHEMA, so the parser folded it to lowercase. #38066 started creating the deployment schema with a quoted name, which made the two disagree for any schema name that is not a bare lowercase identifier: deploy_init created "Prod_dbt_deploy" and then failed trying to alter default privileges in prod_dbt_deploy, after the schema already existed. The retry then took the schema-already-exists branch, which skips both privilege-copying macros, so the operation reported success while silently dropping the grants and default privileges the production schema had.

Test run: https://buildkite.com/materialize/nightly/builds/18074

`internal_copy_schema_default_privs` interpolated the target schema name
raw into `ALTER DEFAULT PRIVILEGES ... IN SCHEMA`, so the parser folded
it to lowercase. MaterializeInc#38066 started creating the deployment schema with a
quoted name, which made the two disagree for any schema name that is not
a bare lowercase identifier: `deploy_init` created `"Prod_dbt_deploy"`
and then failed trying to alter default privileges in `prod_dbt_deploy`,
after the schema already existed. The retry then took the
schema-already-exists branch, which skips both privilege-copying macros,
so the operation reported success while silently dropping the grants and
default privileges the production schema had.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@def-
def- requested review from bobbyiliev and jubrad August 13, 2026 10:40
@def-
def- requested a review from a team as a code owner August 13, 2026 10:40
@def-
def- merged commit 2fc9257 into MaterializeInc:main Aug 13, 2026
20 checks passed
@def-
def- deleted the dbt-deploy-init-quote-default-privs branch August 13, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants