-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ALTER TABLE support for DuckDB tables #652
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, especially given all the tests it seems we have a reasonable coverage. Main question is around the global state lifecycle?
@@ -181,6 +187,7 @@ DuckdbHandleDDL(PlannedStmt *pstmt, const char *query_string, ParamListInfo para | |||
char *access_method = stmt->accessMethod ? stmt->accessMethod : default_table_access_method; | |||
bool is_duckdb_table = strcmp(access_method, "duckdb") == 0; | |||
if (is_duckdb_table) { | |||
pgduckdb::top_level_duckdb_ddl_type = pgduckdb::DDLType::CREATE_TABLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we assert that this is DDLType::NONE
before updating it? (same everywhere we update it). Or we're confident this can never happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty confident it cannot happen, but I guess it's better safe than sorry. So now it throws an error in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do the same below (L216?)
Adds all ALTER TABLE commands that DuckDB can parse except for COLLATION changes and foreign keys. Not all of these ALTER commands are actually supported by DuckDB (e.g. adding CHECK constraints). But this starts to least forward those queries correctly to DuckDB, so once DuckDB supports it pg_duckdb will start to automatically support it as well.
Fixes #536
Fixes #537
Fixes #538
Fixes #539
Fixes #540
Fixes #541
Fixes #542