Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6480f67

Browse files
author
Nikita Glukhov
committed
Remove _ prefix in jsonpath function names
1 parent d590abf commit 6480f67

File tree

4 files changed

+67
-67
lines changed

4 files changed

+67
-67
lines changed

src/include/catalog/pg_operator.dat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,14 +3197,14 @@
31973197
oprresult => 'jsonb', oprcode => 'jsonb_delete_path' },
31983198
{ oid => '6075', descr => 'jsonpath items',
31993199
oprname => '@*', oprleft => 'jsonb', oprright => 'jsonpath',
3200-
oprresult => 'jsonb', oprcode => '_jsonpath_query(jsonb,jsonpath)' },
3200+
oprresult => 'jsonb', oprcode => 'jsonpath_query(jsonb,jsonpath)' },
32013201
{ oid => '6076', descr => 'jsonpath exists',
32023202
oprname => '@?', oprleft => 'jsonb', oprright => 'jsonpath',
3203-
oprresult => 'bool', oprcode => '_jsonpath_exists(jsonb,jsonpath)',
3203+
oprresult => 'bool', oprcode => 'jsonpath_exists(jsonb,jsonpath)',
32043204
oprrest => 'contsel', oprjoin => 'contjoinsel' },
32053205
{ oid => '6107', descr => 'jsonpath predicate',
32063206
oprname => '@~', oprleft => 'jsonb', oprright => 'jsonpath',
3207-
oprresult => 'bool', oprcode => '_jsonpath_predicate(jsonb,jsonpath)',
3207+
oprresult => 'bool', oprcode => 'jsonpath_predicate(jsonb,jsonpath)',
32083208
oprrest => 'contsel', oprjoin => 'contjoinsel' },
32093209

32103210
]

src/include/catalog/pg_proc.dat

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9111,24 +9111,24 @@
91119111
proname => 'jsonpath_out', prorettype => 'cstring', proargtypes => 'jsonpath',
91129112
prosrc => 'jsonpath_out' },
91139113
{ oid => '6054', descr => 'implementation of @? operator',
9114-
proname => '_jsonpath_exists', prorettype => 'bool',
9114+
proname => 'jsonpath_exists', prorettype => 'bool',
91159115
proargtypes => 'jsonb jsonpath', prosrc => 'jsonb_jsonpath_exists2' },
91169116
{ oid => '6055', descr => 'implementation of @* operator',
9117-
proname => '_jsonpath_query', prorows => '1000', proretset => 't',
9117+
proname => 'jsonpath_query', prorows => '1000', proretset => 't',
91189118
prorettype => 'jsonb', proargtypes => 'jsonb jsonpath',
91199119
prosrc => 'jsonb_jsonpath_query2' },
91209120
{ oid => '6056', descr => 'jsonpath exists test',
9121-
proname => '_jsonpath_exists', prorettype => 'bool',
9121+
proname => 'jsonpath_exists', prorettype => 'bool',
91229122
proargtypes => 'jsonb jsonpath jsonb', prosrc => 'jsonb_jsonpath_exists3' },
91239123
{ oid => '6057', descr => 'jsonpath query',
9124-
proname => '_jsonpath_query', prorows => '1000', proretset => 't',
9124+
proname => 'jsonpath_query', prorows => '1000', proretset => 't',
91259125
prorettype => 'jsonb', proargtypes => 'jsonb jsonpath jsonb',
91269126
prosrc => 'jsonb_jsonpath_query3' },
91279127
{ oid => '6073', descr => 'implementation of @~ operator',
9128-
proname => '_jsonpath_predicate', prorettype => 'bool',
9128+
proname => 'jsonpath_predicate', prorettype => 'bool',
91299129
proargtypes => 'jsonb jsonpath', prosrc => 'jsonb_jsonpath_predicate2' },
91309130
{ oid => '6074', descr => 'jsonpath predicate test',
9131-
proname => '_jsonpath_predicate', prorettype => 'bool',
9131+
proname => 'jsonpath_predicate', prorettype => 'bool',
91329132
proargtypes => 'jsonb jsonpath jsonb',
91339133
prosrc => 'jsonb_jsonpath_predicate3' },
91349134

src/test/regress/expected/jsonb_jsonpath.out

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -307,76 +307,76 @@ select jsonb '[1,2,3]' @* '$[last ? (@.type() == "number")]';
307307

308308
select jsonb '[1,2,3]' @* '$[last ? (@.type() == "string")]';
309309
ERROR: Invalid SQL/JSON subscript
310-
select * from _jsonpath_query(jsonb '{"a": 10}', '$');
311-
_jsonpath_query
312-
-----------------
310+
select * from jsonpath_query(jsonb '{"a": 10}', '$');
311+
jsonpath_query
312+
----------------
313313
{"a": 10}
314314
(1 row)
315315

316-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)');
316+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)');
317317
ERROR: could not find jsonpath variable 'value'
318-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 13}');
319-
_jsonpath_query
320-
-----------------
318+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 13}');
319+
jsonpath_query
320+
----------------
321321
{"a": 10}
322322
(1 row)
323323

324-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 8}');
325-
_jsonpath_query
326-
-----------------
324+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 8}');
325+
jsonpath_query
326+
----------------
327327
(0 rows)
328328

329-
select * from _jsonpath_query(jsonb '{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
330-
_jsonpath_query
331-
-----------------
329+
select * from jsonpath_query(jsonb '{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
330+
jsonpath_query
331+
----------------
332332
10
333333
(1 row)
334334

335-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[*] ? (@ < $value)', '{"value" : 13}');
336-
_jsonpath_query
337-
-----------------
335+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[*] ? (@ < $value)', '{"value" : 13}');
336+
jsonpath_query
337+
----------------
338338
10
339339
11
340340
12
341341
(3 rows)
342342

343-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0,1] ? (@ < $value)', '{"value" : 13}');
344-
_jsonpath_query
345-
-----------------
343+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0,1] ? (@ < $value)', '{"value" : 13}');
344+
jsonpath_query
345+
----------------
346346
10
347347
11
348348
(2 rows)
349349

350-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0 to 2] ? (@ < $value)', '{"value" : 15}');
351-
_jsonpath_query
352-
-----------------
350+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0 to 2] ? (@ < $value)', '{"value" : 15}');
351+
jsonpath_query
352+
----------------
353353
10
354354
11
355355
12
356356
(3 rows)
357357

358-
select * from _jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == "1")');
359-
_jsonpath_query
360-
-----------------
358+
select * from jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == "1")');
359+
jsonpath_query
360+
----------------
361361
"1"
362362
(1 row)
363363

364-
select * from _jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == $value)', '{"value" : "1"}');
365-
_jsonpath_query
366-
-----------------
364+
select * from jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == $value)', '{"value" : "1"}');
365+
jsonpath_query
366+
----------------
367367
"1"
368368
(1 row)
369369

370-
select * from _jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ != null)');
371-
_jsonpath_query
372-
-----------------
370+
select * from jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ != null)');
371+
jsonpath_query
372+
----------------
373373
1
374374
"2"
375375
(2 rows)
376376

377-
select * from _jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ == null)');
378-
_jsonpath_query
379-
-----------------
377+
select * from jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ == null)');
378+
jsonpath_query
379+
----------------
380380
null
381381
(1 row)
382382

@@ -591,7 +591,7 @@ select jsonb '{"g": {"x": 2}}' @* '$.g ? (exists (@.x ? (@ >= 2) ))';
591591
--test ternary logic
592592
select
593593
x, y,
594-
_jsonpath_query(
594+
jsonpath_query(
595595
jsonb '[true, false, null]',
596596
'$[*] ? (@ == true && ($x == true && $y == true) ||
597597
@ == false && !($x == true && $y == true) ||
@@ -616,7 +616,7 @@ from
616616

617617
select
618618
x, y,
619-
_jsonpath_query(
619+
jsonpath_query(
620620
jsonb '[true, false, null]',
621621
'$[*] ? (@ == true && ($x == true || $y == true) ||
622622
@ == false && !($x == true || $y == true) ||
@@ -860,15 +860,15 @@ select jsonb '[1,2,3]' @~ '$[*]';
860860
ERROR: Singleton SQL/JSON item required
861861
select jsonb '[]' @~ '$[*]';
862862
ERROR: Singleton SQL/JSON item required
863-
select _jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
864-
_jsonpath_predicate
865-
---------------------
863+
select jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
864+
jsonpath_predicate
865+
--------------------
866866
f
867867
(1 row)
868868

869-
select _jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
870-
_jsonpath_predicate
871-
---------------------
869+
select jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
870+
jsonpath_predicate
871+
--------------------
872872
t
873873
(1 row)
874874

src/test/regress/sql/jsonb_jsonpath.sql

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ select jsonb '[1,2,3]' @* '$[last - 1]';
5353
select jsonb '[1,2,3]' @* '$[last ? (@.type() == "number")]';
5454
select jsonb '[1,2,3]' @* '$[last ? (@.type() == "string")]';
5555

56-
select * from _jsonpath_query(jsonb '{"a": 10}', '$');
57-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)');
58-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 13}');
59-
select * from _jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 8}');
60-
select * from _jsonpath_query(jsonb '{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
61-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[*] ? (@ < $value)', '{"value" : 13}');
62-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0,1] ? (@ < $value)', '{"value" : 13}');
63-
select * from _jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0 to 2] ? (@ < $value)', '{"value" : 15}');
64-
select * from _jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == "1")');
65-
select * from _jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == $value)', '{"value" : "1"}');
66-
select * from _jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ != null)');
67-
select * from _jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ == null)');
56+
select * from jsonpath_query(jsonb '{"a": 10}', '$');
57+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)');
58+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 13}');
59+
select * from jsonpath_query(jsonb '{"a": 10}', '$ ? (.a < $value)', '{"value" : 8}');
60+
select * from jsonpath_query(jsonb '{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
61+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[*] ? (@ < $value)', '{"value" : 13}');
62+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0,1] ? (@ < $value)', '{"value" : 13}');
63+
select * from jsonpath_query(jsonb '[10,11,12,13,14,15]', '$.[0 to 2] ? (@ < $value)', '{"value" : 15}');
64+
select * from jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == "1")');
65+
select * from jsonpath_query(jsonb '[1,"1",2,"2",null]', '$.[*] ? (@ == $value)', '{"value" : "1"}');
66+
select * from jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ != null)');
67+
select * from jsonpath_query(jsonb '[1, "2", null]', '$[*] ? (@ == null)');
6868

6969
select jsonb '{"a": {"b": 1}}' @* 'lax $.**';
7070
select jsonb '{"a": {"b": 1}}' @* 'lax $.**{1}';
@@ -107,7 +107,7 @@ select jsonb '{"g": {"x": 2}}' @* '$.g ? (exists (@.x ? (@ >= 2) ))';
107107
--test ternary logic
108108
select
109109
x, y,
110-
_jsonpath_query(
110+
jsonpath_query(
111111
jsonb '[true, false, null]',
112112
'$[*] ? (@ == true && ($x == true && $y == true) ||
113113
@ == false && !($x == true && $y == true) ||
@@ -120,7 +120,7 @@ from
120120

121121
select
122122
x, y,
123-
_jsonpath_query(
123+
jsonpath_query(
124124
jsonb '[true, false, null]',
125125
'$[*] ? (@ == true && ($x == true || $y == true) ||
126126
@ == false && !($x == true || $y == true) ||
@@ -176,8 +176,8 @@ select jsonb '{}' @~ '$';
176176
select jsonb '[]' @~ '$';
177177
select jsonb '[1,2,3]' @~ '$[*]';
178178
select jsonb '[]' @~ '$[*]';
179-
select _jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
180-
select _jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
179+
select jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
180+
select jsonpath_predicate(jsonb '[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
181181

182182
select jsonb '[null,1,true,"a",[],{}]' @* '$.type()';
183183
select jsonb '[null,1,true,"a",[],{}]' @* 'lax $.type()';

0 commit comments

Comments
 (0)