-
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
release-25.1: opt/optbuilder: only re-type-check values rows for wildcard types #140306
release-25.1: opt/optbuilder: only re-type-check values rows for wildcard types #140306
Conversation
After #129706 we began type-checking expressions in `Values` operators again after building them. This is needed to update the resolved type if there was a RECORD-returning UDF, which cannot resolve its type until after it is built. However, this fix broke some other cases because the initial type-check can discard casts, causing the second time to result in a slightly different type (e.g. `TIMESTAMP` vs `TIMESTAMPTZ`). This commit fixes the oversight by only type-checking the second time if the previously resolved type was a wildcard type like `AnyTuple`, indicating that a concrete type could not be found on the first pass. Fixes #137968 Release note (sql change): Fixed a bug existing only in pre-release versions of v25.1 which could cause unexpected errors during planning for `VALUES` expressions containing function calls with multiple overloads.
b1ca5ce
to
d20043b
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If your backport adds new functionality, please ensure that the following additional criteria are satisfied:
Also, please add a brief release justification to the body of your PR to justify this |
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.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)
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.
Nice fix!!
Backport 1/1 commits from #140277 on behalf of @DrewKimball.
/cc @cockroachdb/release
After #129706 we began type-checking expressions in
Values
operators again after building them. This is needed to update the resolved type if there was a RECORD-returning UDF, which cannot resolve its type until after it is built. However, this fix broke some other cases because the initial type-check can discard casts, causing the second time to result in a slightly different type (e.g.TIMESTAMP
vsTIMESTAMPTZ
). This commit fixes the oversight by only type-checking the second time if the previously resolved type was a wildcard type likeAnyTuple
, indicating that a concrete type could not be found on the first pass.Fixes #137968
Release note (sql change): Fixed a bug existing only in pre-release versions of v25.1 which could cause unexpected errors during planning for
VALUES
expressions containing function calls with multiple overloads.Release justification: narrows the scope of a previous fix to prevent regressions