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

Commit aa64503

Browse files
author
Nikita Glukhov
committed
Fix jsonpath unquoted identifiers
1 parent 985a80c commit aa64503

File tree

6 files changed

+271
-291
lines changed

6 files changed

+271
-291
lines changed

src/backend/utils/adt/jsonpath_gram.y

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ makeItemLikeRegex(JsonPathParseItem *expr, string *pattern, string *flags)
261261
}
262262

263263
%token <str> TO_P NULL_P TRUE_P FALSE_P IS_P UNKNOWN_P EXISTS_P
264-
%token <str> STRING_P NUMERIC_P INT_P VARIABLE_P
264+
%token <str> IDENT_P STRING_P NUMERIC_P INT_P VARIABLE_P
265265
%token <str> OR_P AND_P NOT_P
266266
%token <str> LESS_P LESSEQUAL_P EQUAL_P NOTEQUAL_P GREATEREQUAL_P GREATER_P
267267
%token <str> ANY_P STRICT_P LAX_P LAST_P STARTS_P WITH_P LIKE_REGEX_P FLAG_P
@@ -438,7 +438,8 @@ key:
438438
;
439439

440440
key_name:
441-
STRING_P
441+
IDENT_P
442+
| STRING_P
442443
| TO_P
443444
| NULL_P
444445
| TRUE_P

src/backend/utils/adt/jsonpath_scan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static keyword keywords[] = {
296296
static int
297297
checkSpecialVal()
298298
{
299-
int res = STRING_P;
299+
int res = IDENT_P;
300300
int diff;
301301
keyword *StopLow = keywords,
302302
*StopHigh = keywords + lengthof(keywords),

src/test/regress/expected/jsonb_jsonpath.out

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,12 +909,6 @@ select jsonb 'null' @* '"123".type()';
909909
"string"
910910
(1 row)
911911

912-
select jsonb 'null' @* 'aaa.type()';
913-
?column?
914-
----------
915-
"string"
916-
(1 row)
917-
918912
select jsonb '{"a": 2}' @* '($.a - 5).abs() + 10';
919913
?column?
920914
----------

0 commit comments

Comments
 (0)