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

Commit e052526

Browse files
author
Nikita Glukhov
committed
Fix jsonpath unquoted identifiers
1 parent eb68ded commit e052526

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
@@ -272,7 +272,7 @@ makeItemLikeRegex(JsonPathParseItem *expr, string *pattern, string *flags)
272272
}
273273

274274
%token <str> TO_P NULL_P TRUE_P FALSE_P IS_P UNKNOWN_P EXISTS_P
275-
%token <str> STRING_P NUMERIC_P INT_P VARIABLE_P
275+
%token <str> IDENT_P STRING_P NUMERIC_P INT_P VARIABLE_P
276276
%token <str> OR_P AND_P NOT_P
277277
%token <str> LESS_P LESSEQUAL_P EQUAL_P NOTEQUAL_P GREATEREQUAL_P GREATER_P
278278
%token <str> ANY_P STRICT_P LAX_P LAST_P STARTS_P WITH_P LIKE_REGEX_P FLAG_P
@@ -449,7 +449,8 @@ key:
449449
;
450450

451451
key_name:
452-
STRING_P
452+
IDENT_P
453+
| STRING_P
453454
| TO_P
454455
| NULL_P
455456
| 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
@@ -919,12 +919,6 @@ select jsonb 'null' @* '"123".type()';
919919
"string"
920920
(1 row)
921921

922-
select jsonb 'null' @* 'aaa.type()';
923-
?column?
924-
----------
925-
"string"
926-
(1 row)
927-
928922
select jsonb '{"a": 2}' @* '($.a - 5).abs() + 10';
929923
?column?
930924
----------

0 commit comments

Comments
 (0)