Skip to content

Fix: Fallback to DROP VIEW if DROP TABLE fails in DuckDB#5809

Draft
alessio-giuliano-pix4d wants to merge 1 commit into
SQLMesh:mainfrom
alessio-giuliano-pix4d:fix-duckdb-drop-view
Draft

Fix: Fallback to DROP VIEW if DROP TABLE fails in DuckDB#5809
alessio-giuliano-pix4d wants to merge 1 commit into
SQLMesh:mainfrom
alessio-giuliano-pix4d:fix-duckdb-drop-view

Conversation

@alessio-giuliano-pix4d
Copy link
Copy Markdown

Related issue: #5438

Description

DuckDB has trouble detecting the type of relations when interacting with Postgres through duckdb-postgres: Views are treated like tables. (see linked issue for more detail)

The proposed fix is simply to add a fallback to drop the relation with DROP VIEW if DROP TABLE fails. The code is inspired from another PR attempting a fix: #5695.

Test Plan

I tested this locally on a project that was impacted by issue #5438, and verified that the problem was indeed gone.

Note that since I don't know this codebase at all, I'm not 100% convinced about the robustness of this change.

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
    • I don't really see how to test this in any useful way
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

Signed-off-by: Alessio Giuliano <alessio.giuliano@pix4d.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant