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

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: N/A
   
   Problem Summary:
   
   `DROP TEMPORARY TABLE` issued against a plugin-driven external catalog (for 
example an
   Iceberg catalog) deleted the permanent external table of the same name.
   
   An external catalog has no temporary-table namespace: `CREATE TEMPORARY 
TABLE` is
   rejected for every non-internal catalog, so when the statement names a table 
that is not a
   session temporary table, name resolution falls back to the permanent table 
of that name.
   `PluginDrivenExternalCatalog.dropTable` accepted the `mustTemporary` flag 
but never
   inspected it, forwarded the statement to `ConnectorMetadata.dropTable`, and 
removed the
   permanent table from the external metastore.
   
   Reproduction: create a permanent table `ext.db.t`, then run
   `DROP TEMPORARY TABLE ext.db.t`. Before the fix, `ext.db.t` disappears from 
the external
   metastore. After the fix, the statement reports `Unknown table 't' in db` 
(or is a no-op
   with `IF EXISTS`) and `ext.db.t` is untouched.
   
   The fix mirrors `InternalCatalog.dropTable`: when `mustTemporary` is set, 
the permanent
   table is never handed to the connector. `IF EXISTS` turns the missing 
temporary table into
   a no-op; otherwise the statement raises `ERR_UNKNOWN_TABLE`.
   
   ### Release note
   
   Fix `DROP TEMPORARY TABLE` on an external catalog deleting the permanent 
table of the same
   name. It now reports that the temporary table does not exist (a no-op with 
`IF EXISTS`) and
   leaves the permanent table untouched.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
       - Added two cases to `PluginDrivenExternalCatalogDdlRoutingTest`: the 
non-IF-EXISTS
         error path and the `IF EXISTS` no-op path, both asserting the 
connector is not called
         and no edit log is written.
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. `DROP TEMPORARY TABLE <external table>` now errors (or no-ops 
with
         `IF EXISTS`) instead of dropping the permanent table.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   


-- 
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