Skip to content

Commit b295a06

Browse files
craig[bot]normanchenn
andcommitted
Merge #145068
145068: jsonpath: add logictest for non-integer negative array indexing r=normanchenn a=normanchenn This commit adds a test case for using a negative non-integer array index within JSONPath queries. Negative non-integer indices round towards 0, but negative indices return nothing in lax mode. Epic: None Release note: None Co-authored-by: Norman Chen <[email protected]>
2 parents 6d817b2 + ec8b2ef commit b295a06

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/sql/logictest/testdata/logic_test/jsonb_path_query

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,17 @@ SELECT jsonb_path_query('[1, 2, 3]', '$[-0.99999999]');
16011601
----
16021602
1
16031603

1604+
query empty
1605+
SELECT jsonb_path_query('[1, 2, 3]', '$[-1.01]');
1606+
1607+
query T
1608+
SELECT jsonb_path_query('[1, 2, 3]', 'strict $[-0.9999999999999]');
1609+
----
1610+
1
1611+
1612+
statement error pgcode 22033 pq: jsonpath array subscript is out of bounds
1613+
SELECT jsonb_path_query('[1, 2, 3]', 'strict $[-1.01]');
1614+
16041615
statement error pgcode 42704 pq: could not find jsonpath variable "value"
16051616
SELECT jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)');
16061617

0 commit comments

Comments
 (0)