-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
importccl: support unchecked foreign keys in IMPORT PGDUMP #27425
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.
Reviewed 6 of 6 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/ccl/importccl/import_stmt.go, line 259 at r1 (raw file):
// Implements the sql.SchemaResolver interface. func (r fkResolver) LogicalSchemaAccessor() sql.SchemaAccessor { return nil
I'm a little wary of returning zero values rather than panicking if we think we'll never be called, just in case we start silently returning non-sense later and it goes undetected. /¢2.
pkg/ccl/importccl/read_import_pgdump.go, line 254 at r1 (raw file):
switch cmd := cmd.(type) { case *tree.AlterTableAddConstraint: create.Defs = append(create.Defs, cmd.ConstraintDef)
this is going to break on circular reference relationships.
I think we'll need to evaluate all the CREATEs into descs, then modify the descs to add the FKs rather than letting MakeSimpleTableDesc do it for us.
More than happy to punt that to a follow up though.
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.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/ccl/importccl/import_stmt.go, line 259 at r1 (raw file):
Previously, dt (David Taylor) wrote…
I'm a little wary of returning zero values rather than panicking if we think we'll never be called, just in case we start silently returning non-sense later and it goes undetected. /¢2.
I agree. And it's unclear what to do here. I feel like explicitly panicking here is wrong, but returning a nil will just panic somewhere else for maybe an unclear reason? Dunno. I'm going to merge as is and we can change it if we need to.
bors r+ |
Build failed |
bors r+ |
Build failed |
We achieve this by implementing sql.SchemaResolver with a map from the found tables in the IMPORT and using that to resolve table names during FK creation. Release note (sql change): support foreign keys in IMPORT PGDUMP.
bors r+ |
27425: importccl: support unchecked foreign keys in IMPORT PGDUMP r=mjibson a=mjibson We achieve this by implementing sql.SchemaResolver with a map from the found tables in the IMPORT and using that to resolve table names during FK creation. Release note (sql change): support foreign keys in IMPORT PGDUMP. Co-authored-by: Matt Jibson <[email protected]>
Build succeeded |
We achieve this by implementing sql.SchemaResolver with a map from the
found tables in the IMPORT and using that to resolve table names during
FK creation.
Release note (sql change): support foreign keys in IMPORT PGDUMP.