pg_duckdb icon indicating copy to clipboard operation
pg_duckdb copied to clipboard

feat: Implement ALTER TABLE SET SCHEMA for DuckDB tables

Open shivampr opened this issue 4 months ago • 1 comments

Description

  • Implemented DuckdbHandleAlterTableSetSchema to support moving DuckDB tables between schemas within the same database.
  • Updated DDL interception to call this handler instead of raising an error.
  • Added regression tests covering error scenarios for non-existent tables/schemas.

Testing

  • Ran make check to verify Postgres regression tests pass.
  • Manually created DuckDB tables, moved them between schemas with ALTER TABLE … SET SCHEMA, and confirmed data is preserved.
  • Ran make pycheck locally (without MotherDuck token) to ensure non-MotherDuck Python (19)tests pass.

Fixes #781.

shivampr avatar Aug 18 '25 03:08 shivampr

Thanks for the feedback, @JelteF I’ve updated the PR description to be more focused. This PR only covers moving DuckDB tables within the same database, I’ll address the remaining requirements in a follow-up commit.

I had tested locally with make check and by manually moving tables between schemas. I also ran make pycheck without a MotherDuck token, so I haven’t validated against MotherDuck yet. Could you point me to how I can obtain a test token for that?

shivampr avatar Aug 19 '25 05:08 shivampr

Thanks a lot for the contribution, but I'm starting to think that we should simply not support this until duckdb itself actually has support for this command.

JelteF avatar Dec 01 '25 11:12 JelteF