Skip to content

feat: add ALTER TABLE SET SCHEMA hook support#315

Open
sfc-gh-vparakh wants to merge 2 commits intomainfrom
vparakh/alter-table-set-schema-hook
Open

feat: add ALTER TABLE SET SCHEMA hook support#315
sfc-gh-vparakh wants to merge 2 commits intomainfrom
vparakh/alter-table-set-schema-hook

Conversation

@sfc-gh-vparakh
Copy link
Copy Markdown
Collaborator

Summary

  • Add PgLakeAlterTableSetSchemaHook to allow replication extensions to handle ALTER TABLE SET SCHEMA
  • Add PgLakeIsReplicationTargetHook to skip read-only check for replication targets
  • Export both hooks via PGDLLEXPORT for shared library access

Context

This enables pg_lake_replication and snowflake_cdc extensions to properly track table schema changes when tables are moved between schemas via ALTER TABLE SET SCHEMA.

Test plan

  • Tested with snowflake_cdc test suite: all 8 test_set_schema tests pass

- Add PgLakeAlterTableSetSchemaHook hook point
- Add PgLakeIsReplicationTargetHook to check if table is replication target
- Bypass read-only check for SET SCHEMA on replication targets only
Copy link
Copy Markdown
Collaborator

@sfc-gh-okalaci sfc-gh-okalaci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to share some context, as far as I know, the immediate goal is to support ALTER TABLE SET SCHEMA in snowflake_cdc.

For that case, I think we should not need pg_lake hooks: snowflake_cdc tracks source heap tables, so PostProcessAlterWritablePgLakeTableSchema wouldn't fire for the tables it tracks.

snowflake_cdc already intercepts this statement via HandleAlterObjectSchemaStmt, I thought we should fill-in the implementation there.

That said, this looks like it would be useful for pg_lake_replication. Do you maybe have plans on that side as well?

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.

2 participants