Skip to content

Translate DROP FOREIGN TABLE and refuse it with CASCADE - #184

Merged
LucaCappelletti94 merged 1 commit into
mainfrom
upstream/drop-foreign-table
Oct 29, 2026
Merged

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

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Collaborator

sqlparser main gained ObjectType::ForeignTable with apache/datafusion-sqlparser-rs#2746, and pg2sqlite matches ObjectType exhaustively in drop_label and in the Statement::Drop arm, so the crate no longer builds against sqlparser main.

CREATE FOREIGN TABLE is already dropped with a foreign data warning (#106), so a plain DROP FOREIGN TABLE removes nothing that exists in the SQLite output and joins DROP SEQUENCE and DROP TYPE as a warned drop. With CASCADE it is refused instead. A view that reads a foreign table still reaches the output, and PostgreSQL deletes that view along with the table, so a warned drop would leave the replica holding a view the source no longer has. This mirrors the refusal of a cascading DROP SCHEMA.

COMMENT ON FOREIGN TABLE needed no change because every COMMENT is already a warned drop, and the statement outcome corpus now covers it.

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

codecov Bot commented Oct 29, 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 merged commit 0110015 into main Oct 29, 2026
19 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