pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: alf.kristian@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #9519: Allows storing scalar json, but fails when querying
Date: Mon, 10 Mar 2014 15:09:52 +0000
Message-ID: <20140310150952.398.53642@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (14+ messages)  latest in thread

Message-ID: <20140310150952.398.53642@wrigleys.postgresql.org>
Permalink:  ../20140310150952.398.53642@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140310150952.398.53642@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alf.kristian@gmail.com
  Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying
  In-Reply-To: <20140310150952.398.53642@wrigleys.postgresql.org>
  References: <20140310150952.398.53642@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox