On 05/29/2014 08:00 AM, Teodor Sigaev wrote:
> postgres=# select  '["\u0000"]'::json->0;
>  ?column?
> ----------
>  "\u0000"
> (1 row)
>
> Time: 1,294 ms
> postgres=# select  '["\u0000"]'::jsonb->0;
>  ?column?
> -----------
>  "\\u0000"
> (1 row)
>
> It seems to me that escape_json() is wrongly used in 
> jsonb_put_escaped_value(), right name of escape_json() is a 
> escape_to_json().
That's a bug. I will look into it. I think we might need to special-case 
\u0000 on output, just as we do on input.
cheers
andrew