From: | Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> |
---|---|
To: | Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Oleg Bartunov <obartunov(at)postgrespro(dot)ru>, Michael Paquier <michael(at)paquier(dot)xyz>, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, David Steele <david(at)pgmasters(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Subject: | Re: jsonpath |
Date: | 2019-03-22 11:48:30 |
Message-ID: | [email protected] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 21.03.2019 16:58, Alexander Korotkov wrote:
> On Tue, Mar 19, 2019 at 8:10 PM Alexander Korotkov
> <a(dot)korotkov(at)postgrespro(dot)ru> wrote:
> Attaches patches improving jsonpath parser. First one introduces
> cosmetic changes, while second gets rid of backtracking. I'm also
> planning to add high-level comment for both grammar and lexer.
Parsing of integers now is wrong: neither JSON specification, nor our json[b]
allow leading zeros in integers and floats starting with a dot.
=# SELECT json '.1';
ERROR: invalid input syntax for type json
LINE 1: SELECT jsonb '.1';
^
DETAIL: Token "." is invalid.
CONTEXT: JSON data, line 1: ....
=# SELECT json '00';
ERROR: invalid input syntax for type json
LINE 1: SELECT jsonb '00';
^
DETAIL: Token "00" is invalid.
CONTEXT: JSON data, line 1: 00
=# SELECT json '00.1';
ERROR: invalid input syntax for type json
LINE 1: SELECT jsonb '00.1';
^
DETAIL: Token "00" is invalid.
CONTEXT: JSON data, line 1: 00...
In JavaScript integers with leading zero are treated as octal numbers,
but leading dot is a allowed:
v8 > 0123
83
v8 > 000.1
Uncaught SyntaxError: Unexpected number
v8> .1
0.1
Attached patch 0003 fixes this issue.
--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment | Content-Type | Size |
---|---|---|
0003-Fix-parsing-of-numbers-in-jsonpath.patch | text/x-patch | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2019-03-22 12:03:59 | Re: GiST VACUUM |
Previous Message | Heikki Linnakangas | 2019-03-22 11:37:36 | Re: GiST VACUUM |