-
Notifications
You must be signed in to change notification settings - Fork 101
Drop MD tables when MD support is disabled #771
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
base: main
Are you sure you want to change the base?
Conversation
fcb25a1
to
e1aa072
Compare
e1aa072
to
4f1078a
Compare
src/pgduckdb_background_worker.cpp
Outdated
.objectSubId = 0, | ||
}; | ||
recordDependencyOn(&schema_address, &extension_address, DEPENDENCY_NORMAL); | ||
recordDependencyOn(&schema_address, &server_address, DEPENDENCY_NORMAL); |
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.
This works for tables in a ddb$
schema, because those will then depend on the SERVER indirectly through their schema. But this doesn't yet work for tables in the default database, for those we need to create a direct dependency between the table and the schema. (and probably we just want to create the direct dependency for any duckdb
table, no matter what schema they are in, just for consistency).
9655d2c
to
9cbf120
Compare
.objectId = oid, | ||
.objectSubId = 0, | ||
}; | ||
recordDependencyOnMDServer(&object_address); |
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.
This should be done in our DDL hook instead. That way the dependency is also recorded when someone creates a motherduck table from Postgres, not just when a table is synced to by the background worker.
d39af6a
to
6065296
Compare
d313255
to
42c3336
Compare
42c3336
to
7a99398
Compare
} else { | ||
// Something went really wrong (since `create_table_succeeded`) | ||
elog(WARNING, "Failed to find table '%s.%s' so won't record dependency to 'motherduck' SERVER", table_name, | ||
postgres_schema_name); |
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.
postgres_schema_name); | |
postgres_schema_name); | |
RollbackAndReleaseCurrentSubTransaction(); | |
return false; |
And as a nit: then we can change this to "early return" style if we change
if (HeapTupleIsValid(new_table_tuple)) {
to the inverse
if (!HeapTupleIsValid(new_table_tuple)) {
Currently PG catalog entries mirroring MD tables are dropped only when the extension is.
This PR changes this behavior to have them depend on the
motherduck
SERVER so that when it is removed, the entries are removed as well.