json/jsonb inconsistence

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(dot)dunstan(at)pgexperts(dot)com>
Subject: json/jsonb inconsistence
Date: 2014-05-29 11:55:47
Message-ID: 53872043.8000506@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2014-05-29 12:00:54 json/jsonb inconsistence - 2
Previous Message Gurjeet Singh 2014-05-29 11:52:56 Re: Proposing pg_hibernate