-
Notifications
You must be signed in to change notification settings - Fork 479
correct & update example to add/drop constraint #21542
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
Conversation
✅ Deploy Preview for cockroachdb-interactivetutorials-docs canceled.
|
✅ Deploy Preview for cockroachdb-api-docs canceled.
|
✅ Netlify Preview
To edit notification comments on pull requests, go to your Netlify project configuration. |
rmloveland
left a comment
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 modulo the multi DDL inside one transaction thing which we explicitly recommend against in https://www.cockroachlabs.com/docs/v25.4/online-schema-changes#schema-changes-within-transactions
9fcb5fc to
e368fde
Compare
rmloveland
left a comment
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, thanks!
DOC-14789
Update the
ALTER TABLEexample to drop & add constraint atomically. For the following reasons, this example did not work (and may have never worked):primary, nottablename_pkeyas per convention).users) is referenced by several FKs in the MovR dataset, so the txn actually rolls back.In 24.1,autocommit_before_ddlwas introduced, which causes the txn to commit before issuing the DDL, which causes the statements to fail.ALTER TABLEwith both DDL subcommands.create_table_with_schema_lockedwas enabled by default, and the MovR tables were adjusted accordingly. This means the tables disallow schema changes unless theschema_lockedstorage param is disabled on the table.The examples are updated (appropriately for each version) to use a different MovR table (
promo_codes), use the correct PK name, disableautocommit_before_ddl, and disable/re-enableschema_lockedto allow the example to work.