diff options
| author | Andrew Dunstan | 2013-10-10 16:21:59 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2013-10-10 16:21:59 +0000 |
| commit | 4d212bac1752e1bad6f3aa6242061c393ae93a0a (patch) | |
| tree | eed4e6beacab0e3af9dbcba309fd5f61a75b854b /src/test | |
| parent | 4b7b9a790405f5826ddfc7e9884805edd5396d75 (diff) | |
json_typeof function.
Andrew Tipton.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/json.out | 29 | ||||
| -rw-r--r-- | src/test/regress/expected/json_1.out | 29 | ||||
| -rw-r--r-- | src/test/regress/sql/json.sql | 15 |
3 files changed, 73 insertions, 0 deletions
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out index 1a357988e4..d7e9694132 100644 --- a/src/test/regress/expected/json.out +++ b/src/test/regress/expected/json.out @@ -962,3 +962,32 @@ select json '{ "a": "null \u0000 escape" }' ->> 'a' as not_unescaped; null \u0000 escape (1 row) +--json_typeof() function +select value, json_typeof(value) + from (values (json '123.4'), + (json '-1'), + (json '"foo"'), + (json 'true'), + (json 'false'), + (json 'null'), + (json '[1, 2, 3]'), + (json '[]'), + (json '{"x":"foo", "y":123}'), + (json '{}'), + (NULL::json)) + as data(value); + value | json_typeof +----------------------+------------- + 123.4 | number + -1 | number + "foo" | string + true | boolean + false | boolean + null | null + [1, 2, 3] | array + [] | array + {"x":"foo", "y":123} | object + {} | object + | +(11 rows) + diff --git a/src/test/regress/expected/json_1.out b/src/test/regress/expected/json_1.out index 201fcb2d20..c9710d22e4 100644 --- a/src/test/regress/expected/json_1.out +++ b/src/test/regress/expected/json_1.out @@ -958,3 +958,32 @@ select json '{ "a": "null \u0000 escape" }' ->> 'a' as not_unescaped; null \u0000 escape (1 row) +--json_typeof() function +select value, json_typeof(value) + from (values (json '123.4'), + (json '-1'), + (json '"foo"'), + (json 'true'), + (json 'false'), + (json 'null'), + (json '[1, 2, 3]'), + (json '[]'), + (json '{"x":"foo", "y":123}'), + (json '{}'), + (NULL::json)) + as data(value); + value | json_typeof +----------------------+------------- + 123.4 | number + -1 | number + "foo" | string + true | boolean + false | boolean + null | null + [1, 2, 3] | array + [] | array + {"x":"foo", "y":123} | object + {} | object + | +(11 rows) + diff --git a/src/test/regress/sql/json.sql b/src/test/regress/sql/json.sql index 4c4c6958bb..ff7675fad0 100644 --- a/src/test/regress/sql/json.sql +++ b/src/test/regress/sql/json.sql @@ -310,3 +310,18 @@ select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8; select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere; select json '{ "a": "null \u0000 escape" }' ->> 'a' as not_unescaped; + +--json_typeof() function +select value, json_typeof(value) + from (values (json '123.4'), + (json '-1'), + (json '"foo"'), + (json 'true'), + (json 'false'), + (json 'null'), + (json '[1, 2, 3]'), + (json '[]'), + (json '{"x":"foo", "y":123}'), + (json '{}'), + (NULL::json)) + as data(value); |
