Skip to content
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

opt: implement ON DELETE SET NULL/DEFAULT #48831

Merged
merged 1 commit into from
May 18, 2020

Conversation

RaduBerinde
Copy link
Member

Implementing the ON DELETE SET NULL and SET DEFAULT actions. These actions
trigger an update in the child table whenever a row is deleted from the parent.

Release note: None

@RaduBerinde RaduBerinde requested a review from a team as a code owner May 13, 2020 21:24
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 6 of 6 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andy-kimball and @RaduBerinde)


pkg/sql/opt/optbuilder/testdata/fk-on-delete-set-default, line 113 at r1 (raw file):

CREATE TABLE child_multicol (
  c INT PRIMARY KEY,
  p INT DEFAULT (c), q INT DEFAULT (p + 1), r INT DEFAULT (p+q),

[nit] inconsistent formatting of the scalar expressions


pkg/sql/opt/optbuilder/testdata/fk-on-delete-set-null, line 6 at r1 (raw file):


exec-ddl
CREATE TABLE child (c INT PRIMARY KEY, p INT REFERENCES parent(p) ON DELETE SET NULL)

how will match simple v. match full interact with this? is it worth adding some tests?

Implementing the ON DELETE SET NULL and SET DEFAULT actions. These actions
trigger an update in the child table whenever a row is deleted from the parent.

Release note: None
Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @andy-kimball and @rytaft)


pkg/sql/opt/optbuilder/testdata/fk-on-delete-set-default, line 113 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

[nit] inconsistent formatting of the scalar expressions

Done.


pkg/sql/opt/optbuilder/testdata/fk-on-delete-set-null, line 6 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

how will match simple v. match full interact with this? is it worth adding some tests?

There is no difference in the cascade - any rows that had any NULLs on the FK columns will not match in the semi-join so will not result in any cascades.

@craig
Copy link
Contributor

craig bot commented May 18, 2020

Build failed

@RaduBerinde
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented May 18, 2020

Build succeeded

@craig craig bot merged commit 38b8c28 into cockroachdb:master May 18, 2020
@RaduBerinde RaduBerinde deleted the on-delete-set branch May 18, 2020 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants