1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix the window-function group_concat() so that it returns an empty string

if it has one or more empty string inputs.  This fixes
a bug introduced by [c6da39115d3e2b0f] on 2019-03-26 (version 3.28.0) and
reported by [forum/forumpost/bf8f43aa522c2299|forum post bf8f43aa522c2299].

FossilOrigin-Name: cec6bb3fc9932ea78ec8e63d9c2d4e56a4d94b8973b9ea46033cc4baa87c0476
This commit is contained in:
drh
2024-05-23 23:26:04 +00:00
parent 294cd87afc
commit e6d3c57204
4 changed files with 28 additions and 9 deletions

View File

@ -2375,5 +2375,23 @@ do_execsql_test 77.2 {
SELECT max(~likely(x)) FILTER (WHERE true) FROM t1 INDEXED BY t1x GROUP BY x;
} {-2 -3 -5 -9}
# 2024-05-23 https://sqlite.org/forum/forumpost/bf8f43aa522c2299
#
# A bug in group_concat() when used as a window function, reported
# just hours after the 3.46.0 release, though first appearing
# in 3.28.0.
#
# When used as a window function, a group_concat() was not
# correctly distinguishing between NULL and empty-string for
# its return value.
#
do_execsql_test 78.1 {
SELECT quote(group_concat(x) OVER ()) FROM (SELECT '' AS x);
} ''
do_execsql_test 78.2 {
SELECT quote(group_concat(x) OVER (
ORDER BY y RANGE BETWEEN 1 FOLLOWING AND 2 FOLLOWING
)) FROM (SELECT 'abc' AS x, 1 AS y);
} NULL
finish_test