Skip to content
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-2.1: sql: Fix the handling of NULL arguments in string_agg #30076

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

BramGruneir
Copy link
Member

Backport 1/1 commits from #29652.

/cc @cockroachdb/release


Prior to this patch, if you called string_agg(x, delim) with a NULL delimiter,
the results were incorrect, as it should behave exactly like concat_agg(x) or
even string_agg(x, ''). This updated behaviour now matches Postgres'.

See the list of new test cases for a more complete list of examples.

This also required adding checking to in distsql for both aggregate and window
functions to allow matching ambiguous results only when the aggregate function
accepts null arguments.

The string_agg algorithm was also cleaned up and its memory counting was
tightened.

Release note (sql bug fix): string_agg() can now accept a NULL as a delimiter.

Prior to this patch, if you called `string_agg(x, delim)` with a NULL delimiter,
the results were incorrect, as it should behave exactly like `concat_agg(x)` or
even `string_agg(x, '')`. This updated behaviour now matches Postgres'.

See the list of new test cases for a more complete list of examples.

This also required adding checking to in distsql for both aggregate and window
functions to allow matching ambiguous results only when the aggregate function
accepts null arguments.

The string_agg algorithm was also cleaned up and its memory counting was
tightened.

Release note (sql bug fix): string_agg() can now accept a NULL as a delimiter.
@BramGruneir BramGruneir added this to the 2.1 milestone Sep 11, 2018
@BramGruneir BramGruneir requested review from jordanlewis, knz and a team September 11, 2018 17:02
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@BramGruneir BramGruneir merged commit 9eedff3 into cockroachdb:release-2.1 Sep 11, 2018
@BramGruneir
Copy link
Member Author

TFTR!

@BramGruneir BramGruneir deleted the backport2.1-29652 branch September 11, 2018 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants