Skip to content

Commit b0b3d5f

Browse files
committed
Fix LISTAGG syntax and some rephrasing
1 parent a877c7e commit b0b3d5f

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

doc/sql.extensions/README.listagg

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
11
SQL Language Extension: LISTAGG
22

33
Function:
4-
The current implementation has an aggregate function LIST which concatenates multiple row
5-
fields into a blob. The SQL standard has a similar function called LISTAGG. The major
6-
difference is that it also supports the ordered concatenation.
4+
LISTAGG is a SQL standard equivalent of the Firebird-specific aggregate function LIST.
5+
It provides concatenation of values within a group, with optional ordering.
76

87
Authors:
98
Chudaykin Alex <chudaykinalex@gmail.com>
109

1110
Format:
1211
<listagg set function> ::=
13-
LISTAGG <left paren> [ <set quantifier> ] <character value expression> <comma> <listagg separator> [ <listagg overflow clause> ] <right paren> [ <within group specification> ]
12+
{ LISTAGG | LIST }
13+
<left paren>
14+
[ ALL | DISTINCT ] <expression>
15+
[ <comma> <listagg separator> ]
16+
[ <listagg overflow clause> ]
17+
<right paren>
18+
[ <within group specification> ]
1419

1520
<listagg separator> ::=
16-
<character string literal>
21+
<character string literal>
1722

1823
<listagg overflow clause> ::=
19-
ON OVERFLOW <overflow behavior>
24+
ON OVERFLOW <overflow behavior>
2025

2126
<overflow behavior> ::=
22-
ERROR | TRUNCATE [ <listagg truncation filler> ] <listagg count indication>
27+
ERROR
28+
| TRUNCATE [ <listagg truncation filler> ] <listagg count indication>
2329

2430
<listagg truncation filler> ::=
25-
<character string literal>
31+
<character string literal>
2632

2733
<listagg count indication> ::=
28-
WITH COUNT | WITHOUT COUNT
34+
WITH COUNT | WITHOUT COUNT
2935

3036
<within group specification> ::=
31-
WITHIN GROUP <left paren> ORDER BY <sort specification list> <right paren>
37+
WITHIN GROUP <left paren> ORDER BY <sort specification list> <right paren>
3238

3339
Syntax Rules:
34-
The legacy LIST syntax is preserved for backward compatibility, LISTAGG is added to cover the
35-
standard features.
40+
The legacy LIST syntax is preserved for backward compatibility and is now an alias for LISTAGG.
3641

37-
There is a <listagg overflow clause> rule in the standard, which is intended to output an error
38-
when the output value overflows. Since the LIST function always returns a BLOB, it was decided
39-
that this rule would be meaningless. So the OVERFLOW clause is syntactically supported but
40-
silently ignored if specified.
42+
The SQL standard defines the <listagg overflow clause>, which is intended to output an error
43+
or truncate when the output value overflows. Since LISTAGG always returns a BLOB, this rule
44+
does not apply. The OVERFLOW clause is syntactically supported but effectively ignored.
4145

4246
Examples:
4347
CREATE TABLE TEST_T

0 commit comments

Comments
 (0)