Skip to content

Commit d600074

Browse files
authored
fix copying default privs for blue/green (#32086)
<!-- fix copying default privs for blue/green deployment when the grantee is PUBLIC --> ### Motivation <!-- Which of the following best describes the motivation behind this PR? * This PR fixes a recognized bug. [Ensure issue is linked somewhere.] * This PR adds a known-desirable feature. [Ensure issue is linked somewhere.] * This PR fixes a previously unreported bug. blue/green deployments break when there is a default priv with the grantee PUBLIC * This PR adds a feature that has not yet been specified. [Write a brief specification for the feature, including justification for its inclusion in Materialize, as if you were writing the original feature specification.] * This PR refactors existing code. [Describe what was wrong with the existing code, if it is not obvious.] --> ### Tips for reviewer <!-- Leave some tips for your reviewer, like: * The diff is much smaller if viewed with whitespace hidden. * [Some function/module/file] deserves extra attention. * [Some function/module/file] is pure code movement and only needs a skim. Delete this section if no tips. --> ### Checklist - [ ] This PR has adequate test coverage / QA involvement has been duly considered. ([trigger-ci for additional test/nightly runs](https://trigger-ci.dev.materialize.com/)) - [ ] This PR has an associated up-to-date [design doc](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/README.md), is a design doc ([template](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/design/00000000_template.md)), or is sufficiently small to not require a design. <!-- Reference the design in the description. --> - [ ] If this PR evolves [an existing `$T ⇔ Proto$T` mapping](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/command-and-response-binary-encoding.md) (possibly in a backwards-incompatible way), then it is tagged with a `T-proto` label. - [ ] If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label ([example](MaterializeInc/cloud#5021)). <!-- Ask in #team-cloud on Slack if you need help preparing the cloud PR. --> - [ ] If this PR includes major [user-facing behavior changes](https://github.com/MaterializeInc/materialize/blob/main/doc/developer/guide-changes.md#what-changes-require-a-release-note), I have pinged the relevant PM to schedule a changelog post.
1 parent c4b507c commit d600074

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

misc/dbt-materialize/dbt/include/materialize/macros/deploy/deploy_init.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ SELECT
165165
'IN SCHEMA {{ to }} ' ||
166166
'GRANT ' || privilege_type || ' ' ||
167167
'ON ' || object_type || 's ' ||
168-
'TO ' || quote_ident(grantee)
168+
CASE
169+
WHEN grantee = 'PUBLIC' THEN 'TO PUBLIC'
170+
ELSE 'TO ' || quote_ident(grantee)
171+
END
169172
FROM mz_internal.mz_show_default_privileges
170173
WHERE database = current_database() AND schema = {{ dbt.string_literal(from) }}
171174
AND object_owner <> 'none' AND grantee <> 'none'

0 commit comments

Comments
 (0)