opt: clean up FK ON UPDATE CASCADE code and opt trees#72466
opt: clean up FK ON UPDATE CASCADE code and opt trees#72466craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
RaduBerinde
left a comment
There was a problem hiding this comment.
Reviewed 1 of 2 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @nehageorge)
pkg/sql/opt/optbuilder/fk_cascade.go, line 875 at r1 (raw file):
// we make them anonymous here. This prevents column name ambiguity in // outScope. There is no need to attach a metadata name here because these // columns have already been added to the metadata with a name above in the
supernit: in the calls to md.AddColumn above.
rytaft
left a comment
There was a problem hiding this comment.
nit: the PR title says "CASECADE"
Reviewed 2 of 2 files at r1, 1 of 4 files at r2, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @nehageorge)
8b2ba51 to
52cb052
Compare
mgartner
left a comment
There was a problem hiding this comment.
nit: the PR title says "CASECADE"
Fixed.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nehageorge, @RaduBerinde, and @rytaft)
pkg/sql/opt/optbuilder/fk_cascade.go, line 875 at r1 (raw file):
Previously, RaduBerinde wrote…
supernit: in the calls to md.AddColumn above.
Done.
nehageorge
left a comment
There was a problem hiding this comment.
Reviewed 1 of 2 files at r1, 4 of 4 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @mgartner)
This commit anonymizes the columns in the input of a foreign key ON UPDATE CASCADE expression. This is safe because these columns can only be referenced by other expressions if they are update columns, and in that case, `mutationBuilder.addUpdateCascade` will give them a distinct name in the scope it produces. This change allows a special case added in cockroachdb#57153 to be removed, without failing the regression test. Release note: None
Columns produced by the WithScan expression in a foreign key ON UPDATE CASCADE now have metadata names based on the column names of the child table, rather than the parent table. This more accurately describes the columns in the cascade plan because the plan is concerned with the child table, not the parent. Metadata names are only used in opt expression trees, so this is purely an aesthetic change, not a semantic one. Release note: None
52cb052 to
2a38cd2
Compare
|
TFTRs! bors r+ |
|
This PR was included in a batch that was canceled, it will be automatically retried |
|
Build succeeded: |
opt: make FK ON UPDATE CASCADE input columns anonymous
This commit anonymizes the columns in the input of a foreign key
ON UPDATE CASCADE expression. This is safe because these columns can
only be referenced by other expressions if they are update columns, and
in that case,
mutationBuilder.addUpdateCascadewill give them adistinct name in the scope it produces. This change allows a special
case added in #57153 to be removed, without failing the regression test.
Release note: None
opt: use more accurate FK ON UPDATE column metadata names
Columns produced by the WithScan expression in a foreign key ON UPDATE
CASCADE now have metadata names based on the column names of the child
table, rather than the parent table. This more accurately describes the
columns in the cascade plan because the plan is concerned with the child
table, not the parent. Metadata names are only used in opt expression
trees, so this is purely an aesthetic change, not a semantic one.
Release note: None