aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonpath_scan.l
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2019-04-01 18:09:09 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2019-04-01 18:09:09 +0300
commit2e643501e5281ad5e0fa626dab1d51c1d38f639a (patch)
treee494392865f4c1ba016ba0156f21bd6457a2a467 /src/backend/utils/adt/jsonpath_scan.l
parent0a02e2ae0236103e641f6570b8135b7ee8a83686 (diff)
downloadpostgresql-2e643501e5281ad5e0fa626dab1d51c1d38f639a.tar.gz
postgresql-2e643501e5281ad5e0fa626dab1d51c1d38f639a.zip
Restrict some cases in parsing numerics in jsonpath
Jsonpath now accepts integers with leading zeroes and floats starting with a dot. However, SQL standard requires to follow JSON specification, which doesn't allow none of these cases. Our json[b] datatypes also restrict that. So, restrict it in jsonpath altogether. Author: Nikita Glukhov
Diffstat (limited to 'src/backend/utils/adt/jsonpath_scan.l')
-rw-r--r--src/backend/utils/adt/jsonpath_scan.l6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/jsonpath_scan.l b/src/backend/utils/adt/jsonpath_scan.l
index 4b913c3beef..12ef81b3083 100644
--- a/src/backend/utils/adt/jsonpath_scan.l
+++ b/src/backend/utils/adt/jsonpath_scan.l
@@ -80,9 +80,9 @@ any [^\?\%\$\.\[\]\{\}\(\)\|\&\!\=\<\>\@\#\,\*:\-\+\/\\\"\' \t\n\r\f]
blank [ \t\n\r\f]
digit [0-9]
-integer {digit}+
-decimal {digit}*\.{digit}+
-decimalfail {digit}+\.
+integer (0|[1-9]{digit}*)
+decimal {integer}\.{digit}+
+decimalfail {integer}\.
real ({integer}|{decimal})[Ee][-+]?{digit}+
realfail1 ({integer}|{decimal})[Ee]
realfail2 ({integer}|{decimal})[Ee][-+]