json/jsonb inconsistence - Mailing list pgsql-hackers

From Teodor Sigaev
Subject json/jsonb inconsistence
Date
Msg-id [email protected]
Whole thread Raw
Responses Re: json/jsonb inconsistence
List pgsql-hackers
# select  '"\uaBcD"'::json;   json
---------- "\uaBcD"

but

# select  '"\uaBcD"'::jsonb;
ERROR:  invalid input syntax for type json
LINE 1: select  '"\uaBcD"'::jsonb;                ^
DETAIL:  Unicode escape values cannot be used for code point values above 007F 
when the server encoding is not UTF8.
CONTEXT:  JSON data, line 1: ...

and

# select  '"\uaBcD"'::json -> 0;
ERROR:  invalid input syntax for type json
DETAIL:  Unicode escape values cannot be used for code point values above 007F 
when the server encoding is not UTF8.
CONTEXT:  JSON data, line 1: ...
Time: 0,696 ms

More than, json looks strange:

# select  '["\uaBcD"]'::json;    json
------------ ["\uaBcD"]

but

# select  '["\uaBcD"]'::json->0;
ERROR:  invalid input syntax for type json
DETAIL:  Unicode escape values cannot be used for code point values above 007F 
when the server encoding is not UTF8.
CONTEXT:  JSON data, line 1: [...

Looks like random parse rules.

-- 
Teodor Sigaev                                   E-mail: [email protected]
  WWW: http://www.sigaev.ru/
 



pgsql-hackers by date:

Previous
From: Gurjeet Singh
Date:
Subject: Re: Proposing pg_hibernate
Next
From: Teodor Sigaev
Date:
Subject: json/jsonb inconsistence - 2