opt: assignment casts of non-equivalent types in DEFAULT and ON UPDATE#81863
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom May 26, 2022
Merged
Conversation
Member
This commit allows the optimizer to build assignment casts for `DEFAULT` and `ON UPDATE` expressions that have types that are not equivalent with their column's type. If the cast from the `DEFAULT` or `ON UPDATE` expression type to the column type is not a valid assignment cast, an error is returned. In practice, this error should never occur because 1) it is currently impossible to create `DEFAULT` and `ON UPDATE` expressions that do not match their column's type (the tests here get around this limitation because they use the optimizer test catalog which has much looser restrictions) and 2) a future PR will allow creating `DEFAULT` and `ON UPDATE` expressions that do not match their column's type only if the cast from the expression type to the column type is a valid assignment cast. Unblocks cockroachdb#81071 Release note: None
f5c5073 to
f542e2e
Compare
msirek
approved these changes
May 26, 2022
Contributor
msirek
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @e-mbrown and @michae2)
Contributor
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit allows the optimizer to build assignment casts for
DEFAULTand
ON UPDATEexpressions that have types that are not equivalent withtheir column's type. If the cast from the
DEFAULTorON UPDATEexpression type to the column type is not a valid assignment cast, an
error is returned. In practice, this error should never occur because 1)
it is currently impossible to create
DEFAULTandON UPDATEexpressions that do not match their column's type (the tests here get
around this limitation because they use the optimizer test catalog which
has much looser restrictions) and 2) a future PR will allow creating
DEFAULTandON UPDATEexpressions that do not match their column'stype only if the cast from the expression type to the column type is a
valid assignment cast.
Unblocks #81071
Release note: None