The following bug has been logged on the website:
Bug reference: 9519
Logged by: Alf Kristian Støyle
Email address: alf.kristian@gmail.com
PostgreSQL version: 9.3.2
Operating system: Red Hat 4.6.3-2
Description:
Steps to reproduce:
create table jtest (data json);
=> CREATE TABLE
insert into jtest (data) values ('1');
=> INSERT 0 1
select data->>'foo' from jtest;
=> ERROR: cannot extract element from a scalar
I think the insert should fail, since '1' is not valid JSON.
After the data is in the database every query using the ->> operator,
hitting the row containing '1' will fail.
Our database runs in Amazon RDS, 'select version();' returns:
PostgreSQL 9.3.2 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.6.3
20120306 (Red Hat 4.6.3-2), 64-bit