Re: Unexpected zero results

2022-03-23 Thread Tom Lane
"David G. Johnston" writes: > On Wed, Mar 23, 2022 at 10:10 AM Viliam Ďurina > wrote: >> Now I'm surprised that a set-returning function is even allowed in SELECT >> clause where the values have to be scalar. > AFAIK the lateral construct, which is required to avoid doing just this, is > a relat

Re: Unexpected zero results

2022-03-23 Thread David G. Johnston
On Wed, Mar 23, 2022 at 10:10 AM Viliam Ďurina wrote: > Now I'm surprised that a set-returning function is even allowed in SELECT > clause where the values have to be scalar. > AFAIK the lateral construct, which is required to avoid doing just this, is a relatively recent invention for SQL. I i

Re: Unexpected zero results

2022-03-23 Thread Viliam Ďurina
I've just realized that. I used it as an equivalent of the standard `JSON_QUERY` that returns a JSON value. If the expression matches multiple values, it can wrap them in a JSON array. Now I'm surprised that a set-returning function is even allowed in SELECT clause where the values have to be scal

Re: Unexpected zero results

2022-03-23 Thread Thomas Kellerer
Viliam Ďurina schrieb am 23.03.2022 um 17:56: Hello all, I'm experimenting with JSON-path functions, and stumbled upon this query:   SELECT jsonb_path_query('[1,2,3]', '$[*]?(@ == 4)') It returns 0 rows. I expected it to return one row with `null` value. Isn't it the case that `SELECT ` shoul