aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/json/json_query/on_empty.sql
blob: e6d8d4482b730b26f45d91a08038bbb1e08f4471 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
/* syntax version 1 */
/* postgres can not */

-- Accessing absent object member will cause empty result in lax mode
$json = CAST("{}" as Json);
SELECT
    JSON_QUERY($json, "lax $.key"), -- defaults to NULL ON EMPTY
    JSON_QUERY($json, "lax $.key" NULL ON EMPTY),
    JSON_QUERY($json, "lax $.key" EMPTY ARRAY ON EMPTY),
    JSON_QUERY($json, "lax $.key" EMPTY OBJECT ON EMPTY);