-
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
sql: fix labelled tuple type checking #106553
Conversation
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! 0 of 0 LGTMs obtained (waiting on @mgartner, @msirek, and @qiyanghe1998)
pkg/sql/sem/tree/type_check.go
line 2802 at r1 (raw file):
// mimics the check in (*Tuple).TypeCheck. firstLen := len(first.Exprs) if len(first.Labels) > 0 && len(first.Labels) != firstLen {
Should we check other tuples than the first? What happens for a test like:
SELECT CASE WHEN False THEN ROW() ELSE (ROW() AS a) END;
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 all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @qiyanghe1998)
69110a3
to
9c44f03
Compare
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball and @qiyanghe1998)
pkg/sql/sem/tree/type_check.go
line 2802 at r1 (raw file):
Previously, DrewKimball (Drew Kimball) wrote…
Should we check other tuples than the first? What happens for a test like:
SELECT CASE WHEN False THEN ROW() ELSE (ROW() AS a) END;
Good call. Done.
Fixes cockroachdb#106303 Release note (bug fix): A bug has been fixed that caused internal errors instead of user errors when queries contained labelled tuples with a different number of elements and labels, e.g., `(ROW(1, 2) AS a)`. This bug was present since v23.1.0.
9c44f03
to
19860c2
Compare
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 r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @qiyanghe1998)
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.
Reviewable status: complete! 2 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)
TFTRs! bors r+ |
Build succeeded: |
Fixes #106303
Release note (bug fix): A bug has been fixed that caused internal errors
instead of user errors when queries contained labelled tuples with a
different number of elements and labels, e.g.,
(ROW(1, 2) AS a)
. Thisbug was present since v23.1.0.