[KYUUBI #3845][AUTHZ] CREATE OR REPLACE operation requires both CREATE and DROP table privileges - #7748
Open
attilapiros wants to merge 2 commits into
Open
[KYUUBI #3845][AUTHZ] CREATE OR REPLACE operation requires both CREATE and DROP table privileges#7748attilapiros wants to merge 2 commits into
attilapiros wants to merge 2 commits into
Conversation
attilapiros
marked this pull request as draft
September 17, 2026 23:51
…ed to CREATE and DROP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
CREATE OR REPLACE TABLEare authorized as pure creates today: theReplaceTable/ReplaceTableAsSelectlogical plans map only toCREATETABLE/CREATETABLE_AS_SELECT, which require just theCREATEprivilege on the target table.But these commands atomically drop and recreate the table - when the target already exists, its schema and all its data are destroyed. That means a user who was granted
CREATEbut deliberately notDROPon a table can still wipe it out withREPLACE TABLE, bypassing the very privilege an admin withheld to prevent destruction.This PR makes
REPLACE TABLE/CREATE OR REPLACE TABLErequire bothCREATEandDROPon the target table, so the privilege model reflects what the operation can actually do.To express this:
AccessType.applychanged to return multiple access types and renamed toAccessType.getAccessTypesOperationTypes:REPLACETABLEandREPLACETABLE_AS_SELECTwhich mapped for bothDROPandCREATEaccess types.How was this patch tested?
The unit test was extended.
Was this patch assisted by generative AI tooling?
Assisted-by: Claude Opus 4.8