Skip to content

Drop a partitioned table together with its partitions - #174

Merged
LucaCappelletti94 merged 1 commit into
mainfrom
upstream/drop-partitioned-table
Oct 28, 2026
Merged

LucaCappelletti94 merged 1 commit into
mainfrom
upstream/drop-partitioned-table

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

DROP TABLE on a partitioned table was refused while it had partitions, because every table below the dropped one was treated like an INHERITS child that only CASCADE may take along. PostgreSQL drops a partitioned table's partitions with it on its own, nested and attached ones included, and keeps requiring CASCADE only for INHERITS children. The drop now follows that, and dropping a partition leaves its root standing.

Since partitions now leave with their root, a view reading one of them or a foreign key pointing at one from a table that stays holds the drop back the same way it does for the named table, and CASCADE removes the view or cuts the key. The cascaded INHERITS drop gains the same view removal, which used to leave views on the children behind. Every name in the statement resolves before anything is dropped, as in PostgreSQL, so DROP TABLE p, c drops both and an absent name is reported before anything changes.

This stacks on #172 because main cannot build against the current sqlparser until that one merges.

@LucaCappelletti94 LucaCappelletti94 added the bug Something isn't working label Oct 28, 2026
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/drop-partitioned-table branch from 598b219 to 56907f2 Compare October 28, 2026 21:48
@LucaCappelletti94
LucaCappelletti94 changed the base branch from upstream/attach-partition-of to main October 28, 2026 21:48
@LucaCappelletti94
LucaCappelletti94 merged commit 83fa69e into main Oct 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant