> On 04.06.2024, at 07:00, jian he <jian.universal...@gmail.com> wrote: > > On Tue, May 28, 2024 at 5:29 PM Markus Winand <markus.win...@winand.at> wrote: > >> 2. EMPTY [ARRAY|OBJECT] ON ERROR implies ERROR ON EMPTY >> >> 17beta1=# SELECT JSON_QUERY('[]', '$[*]' EMPTY ARRAY ON ERROR) a; >> a >> ---- >> [] >> (1 row) >> >> As NULL ON EMPTY is implied, it should give the same result as >> explicitly adding NULL ON EMPTY: >> > > I vaguely remember, we stumbled on ON ERROR, ON EMPTY several times. > i don't have a standard,
In my understanding of the standard is that there is no distinction between an explicit and implicit ON EMPTY clause. E.g. clause 6.35 (json_query) Syntax Rule 4: • If <JSON query empty behavior> is not specified, then NULL ON EMPTY is implicit. General Rule 5ai then covers the NULL ON EMPTY case: • i) If the length of SEQ2 is 0 (zero) and ONEMPTY is NULL, then let JV be the null value. Neither of these make the ON EMPTY handling dependent on the presence of ON ERROR. -markus