Asthenia0412 opened a new pull request, #67987:
URL: https://github.com/apache/doris/pull/67987

   ### What problem does this PR solve?
   
   Issue Number: close #67345
   
   Related PR: N/A
   
   Problem Summary: A dictionary is authorized with the table privilege key of 
the internal catalog, so a table and a dictionary share the privilege namespace 
and must never share a name in the same database. Previously neither CREATE 
DICTIONARY nor CREATE TABLE checked the other object type, so a user could 
create a dictionary named like an existing table (or vice versa), making the 
privilege key ambiguous and the object unreachable by the other command.
   
   This commit adds a mutual existence check on both paths:
   - DictionaryManager.createDictionary() rejects creating a dictionary when a 
table with the same name already exists in the database.
   - InternalCatalog.createTable() rejects creating a table when a dictionary 
with the same name already exists in the database. IF NOT EXISTS does not 
suppress this, since the table itself does not exist and the collision is with 
a dictionary.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test: Unit test
       - DictionaryManagerTest: dictionary creation rejected on table name 
collision
       - InternalCatalogDictionaryCollisionTest: table creation rejected on 
dictionary name collision
   - Behavior changed: Yes (rejects the conflicting object creation)
   - Does this need documentation: No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to