[HACKERS] potential bug in JSON

2013-05-28 Thread Szymon Guz
I've found a potential bug. Why the - operator returns JSON instead of TEXT? It doesn't make sens for me, and the documentation doesn't inform about that. postgres=# SELECT ('{id: 1}'::json - 'id')::int; ERROR: cannot cast type json to integer LINE 1: SELECT ('{id: 1}'::json - 'id')::int;

Re: [HACKERS] potential bug in JSON

2013-05-28 Thread Andrew Dunstan
On 05/28/2013 11:38 AM, Szymon Guz wrote: I've found a potential bug. Why the - operator returns JSON instead of TEXT? It doesn't make sens for me, and the documentation doesn't inform about that. postgres=# SELECT ('{id: 1}'::json - 'id')::int; ERROR: cannot cast type json to integer LINE

Re: [HACKERS] potential bug in JSON

2013-05-28 Thread Josh Berkus
On 05/28/2013 08:38 AM, Szymon Guz wrote: I've found a potential bug. Why the - operator returns JSON instead of TEXT? It doesn't make sens for me, and the documentation doesn't inform about that. Yes, it most certainly does: http://www.postgresql.org/docs/9.3/static/functions-json.html If

Re: [HACKERS] potential bug in JSON

2013-05-28 Thread Szymon Guz
On 28 May 2013 17:53, Josh Berkus j...@agliodbs.com wrote: On 05/28/2013 08:38 AM, Szymon Guz wrote: I've found a potential bug. Why the - operator returns JSON instead of TEXT? It doesn't make sens for me, and the documentation doesn't inform about that. Yes, it most certainly does: