1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Teach jsonpath string() to unwrap in lax mode

This was an ommission in commit 66ea94e, and brings it into compliance
with both other methods and the standard.

Per complaint from David Wheeler.

Author: David Wheeler, Jeevan Chalke
Reviewed-by: Chapman Flack

Discussion: https://postgr.es/m/A64AE04F-4410-42B7-A141-7A7349260F4D@justatheory.com
This commit is contained in:
Andrew Dunstan
2024-06-17 10:31:29 -04:00
parent 81d20fbf7a
commit 653d3969bb
4 changed files with 19 additions and 2 deletions

View File

@@ -2525,7 +2525,10 @@ select jsonb_path_query('null', '$.string()', silent => true);
(0 rows)
select jsonb_path_query('[]', '$.string()');
ERROR: jsonpath item method .string() can only be applied to a bool, string, numeric, or datetime value
jsonb_path_query
------------------
(0 rows)
select jsonb_path_query('[]', 'strict $.string()');
ERROR: jsonpath item method .string() can only be applied to a bool, string, numeric, or datetime value
select jsonb_path_query('{}', '$.string()');
@@ -2576,6 +2579,13 @@ select jsonb_path_query('1234', '$.string().type()');
"string"
(1 row)
select jsonb_path_query('[2, true]', '$.string()');
jsonb_path_query
------------------
"2"
"true"
(2 rows)
select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp().string()');
ERROR: cannot convert value from timestamptz to timestamp without time zone usage
HINT: Use *_tz() function for time zone support.