Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WN5QB-0007Kq-LB for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Mar 2014 18:59:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WN5QB-00061P-4z for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Mar 2014 18:59:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WN1q8-0007v4-Pw for pgsql-bugs@postgresql.org; Mon, 10 Mar 2014 15:10:04 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WN1q6-00015E-Da for pgsql-bugs@postgresql.org; Mon, 10 Mar 2014 15:10:04 +0000 MIME-Version: 1.0 Subject: BUG #9519: Allows storing scalar json, but fails when querying To: pgsql-bugs@postgresql.org From: alf.kristian@gmail.com Date: Mon, 10 Mar 2014 15:09:52 +0000 Message-ID: <20140310150952.398.53642@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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