-
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 panic with null delimiter in string_agg #28837
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.
Nice catch!
Please add a logic test for this.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/sql/sem/builtins/aggregate_builtins.go, line 642 at r1 (raw file):
// via the first element in others. if len(others) == 1 { if others[0] == tree.DNull {
This behaviour is incorrect. In postgres, using a NULL in both a window function or normal aggregate, the result is to treat it as an empty delimiter.
I added a logic test containing this massive query that caught the bug. I actually can't figure out how to reproduce with just a simple window function! Maybe we could sit together and look at it? |
Closes cockroachdb#28836. Release note: None
e90c021
to
8900d13
Compare
Reduced the test case. PTAL |
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
bors r+ |
28837: sql: fix panic with null delimiter in string_agg r=jordanlewis a=jordanlewis Closes #28836. Release note: None Co-authored-by: Jordan Lewis <[email protected]>
Build succeeded |
Closes #28836.
Release note: None