1. Andrew Dunstan
  2. json_91

Commits

Andrew Dunstan  committed 37f3664

Import logic fix from upstream.

Fix by Peter Eisentraut.

  • Participants
  • Parent commits e9885d2
  • Branches master

Comments (0)

Files changed (3)

File src/json.c

View file
  • Ignore whitespace
 	if (*s == '.')
 	{
 		++s;
-		if (*s < '0' && *s > '9')
+		if (*s < '0' || *s > '9')
 			error = true;
 		else
 		{
 		++s;
 		if (*s == '+' || *s == '-')
 			++s;
-		if (*s < '0' && *s > '9')
+		if (*s < '0' || *s > '9')
 			error = true;
 		else
 		{

File test/expected/json91.out

View file
  • Ignore whitespace
 LINE 1: SELECT '1f2'::json;
                ^
 DETAIL:  line 1: Token "1f2" is invalid.
+SELECT '0.x1'::json;            -- ERROR
+ERROR:  invalid input syntax for type json
+LINE 1: SELECT '0.x1'::json;
+               ^
+DETAIL:  line 1: Token "0.x1" is invalid.
+SELECT '1.3ex100'::json;        -- ERROR
+ERROR:  invalid input syntax for type json
+LINE 1: SELECT '1.3ex100'::json;
+               ^
+DETAIL:  line 1: Token "1.3ex100" is invalid.
 -- Arrays.
 SELECT '[]'::json;				-- OK
  json 

File test/sql/json91.sql

View file
  • Ignore whitespace
 SELECT '1e100'::json;			-- OK
 SELECT '1.3e100'::json;			-- OK
 SELECT '1f2'::json;				-- ERROR
+SELECT '0.x1'::json;            -- ERROR
+SELECT '1.3ex100'::json;        -- ERROR
 
 -- Arrays.
 SELECT '[]'::json;				-- OK