-
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
sql: Support ALTER TABLE ADD COLUMN colname REFERENCES tablename(colname); #32917
Comments
This is needed for #5582 right? |
@awoods187 this looks like a small effort. |
And also clean up the wording to be more explicit. The error for not being able to add a reference via alter was pointing to the incorrect github ID cockroachdb#8855. It's been updated to point to cockroachdb#32917 instead. Release note: None
33144: sql: Uopdate unimplemented reference r=BramGruneir a=BramGruneir And also clean up the wording to be more explicit. The error for not being able to add a reference via alter was pointing to the incorrect github ID #8855. It's been updated to point to #32917 instead. Release note: None Co-authored-by: Bram Gruneir <bram@cockroachlabs.com>
For what it's worth, I just hit this while writing a migration for the managed service console. Would be nice to support. |
This will eventually be fixed through cockroachdb#32917 Also added a unittest to check that this fails specifically for a column needing a backfill. Release note: None
This will eventually be fixed through cockroachdb#32917 Also added a unittest to check that this fails specifically for a column needing a backfill. Release note: None
35697: sql: improve error message while adding column with REFERENCE r=vivekmenezes a=vivekmenezes This will eventually be fixed through #32917 Also added a unittest to check that this fails specifically for a column needing a backfill. Release note: None Co-authored-by: Vivek Menezes <vivek@cockroachlabs.com>
@awoods187 can you help me understand the relative urgency of this? It sounds like it would help us add foreign keys transactionally but I'm not sure how much that buys us for ORM compat. |
I'm not sure--it was needed for compat but a lot of work has changed here with FKs and ORMs. @jordanlewis do you know? |
I'd like to tackle this soon. cc @rohany |
Just to clarify this is just adding a foreign key constraint on the column right |
Fixes cockroachdb#32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax.
Fixes cockroachdb#32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax for tables that are empty.
Fixes cockroachdb#32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax for tables that are empty.
Fixes cockroachdb#32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax for tables that are empty.
Fixes cockroachdb#32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax for tables that are empty.
47082: sql: support the ADD COLUMN ... REFERENCES syntax r=lucy-zhang a=rohany Fixes #32917. This PR adds support for the add column references statement by allowing the foreign key building code to use columns and indexes added in the current txn. The schema changer already understands how to add the combination of the three in the same transaction. Release note (sql change): This PR adds support for the `ALTER TABLE ... ADD COLUMN ... REFERENCES ...` syntax. Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu>
Nice! |
\o/ |
This is currently unimplemented (and returns an error) but I don't think it would be hard to add. There's no worry about violating the constraint since the column is new.
It also points to #8855, but that's not the correct issue. So I'll send a PR to update the issue number to this one.
Assigning @vivekmenezes for triage.
The text was updated successfully, but these errors were encountered: