You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] SQL commands can modify persistent tables shadowed by temporary objects #1372
I searched in the issues and found nothing similar.
Please describe the bug 🐞
When a temporary table or view shadows a persistent Paimon table, SELECT resolves to the temporary object, but some SQL commands can still modify the underlying persistent table.
The affected commands include ALTER TABLE (including ADD PARTITION, DROP PARTITION, and schema changes), INSERT OVERWRITE ... PARTITION, MSCK REPAIR TABLE, and ANALYZE TABLE. The reproduction below shows how DROP PARTITION deletes data from the hidden persistent table.
Reproduction
Run the setup on a fresh table for each case.
CREATETABLEpaimon.default.events (id INT, pt INT) PARTITIONED BY (pt);
INSERT INTOpaimon.default.events VALUES (1, 1), (2, 2);
CREATE TEMPORARY VIEW paimon.default.events ASSELECT99AS id;
SELECT id FROMpaimon.default.events; -- Returns 99 from the temporary view.
Run one of these commands while the temporary view exists.
ALTERTABLEpaimon.default.events DROP PARTITION (pt =1);
Remove the temporary view and inspect the persistent table.
DROP TEMPORARY VIEW paimon.default.events;
SELECT id, pt FROMpaimon.default.events ORDER BY id;
Expected — Both commands reject the temporary target. The persistent table still contains (1, 1) and (2, 2).
Actual — DROP PARTITION succeeds and leaves only (2, 2). In a separate run, INSERT OVERWRITE succeeds and replaces (1, 1) with (8, 1).
Solution
Reuse the existing temporary-object lookup to reject these commands before they modify the persistent table's data, partition registrations, or statistics.
changed the title [-][Bug] DROP PARTITION deletes data from a persistent table shadowed by a temporary view[/-][+][Bug] SQL commands can modify persistent tables shadowed by temporary objects[/+]on Nov 11, 2026
Activity
[-][Bug] DROP PARTITION deletes data from a persistent table shadowed by a temporary view[/-][+][Bug] SQL commands can modify persistent tables shadowed by temporary objects[/+]