agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Diway <diway@diway.net>
To: pgsql-sql@postgresql.org
Subject: json and aggregate
Date: Mon, 4 Nov 2013 12:22:36 -0800 (PST)
Message-ID: <1383596556949-5776903.post@n5.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Hi,
Why is the following query not working ?
select sum((json_array_elements(data)->>'lines')::integer) as test from
test2 where id = 2;
ERROR: set-valued function called in context that cannot accept a set
('data' is obviously a json datatype)
On the other side, this one is OK but I don't like it ;-)
select sum(value) from (select
(json_array_elements(data)->>'lines')::integer as value from test2 where id
= 2) x;
Thanks!
--
View this message in context: http://postgresql.1045698.n5.nabble.com/json-and-aggregate-tp5776903.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (4+ messages) latest in thread
Message-ID: <1383596556949-5776903.post@n5.nabble.com>
Permalink: ../1383596556949-5776903.post@n5.nabble.com/
Also on: postgresql.org/message-id/1383596556949-5776903.post@n5.nabble.com
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: diway@diway.net
Subject: Re: json and aggregate
In-Reply-To: <1383596556949-5776903.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox