Re: JSON query help

From: Gavin Henry <gavin(dot)henry(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: JSON query help
Date: 2019-08-28 23:37:03
Message-ID: CAA8_NKCgfqgyjJ2L4BqHQ7QwLy1JjFoXnzQ_yeYEgppieqAD-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks, that worked! Now I need to go back to basics and SETS:

SELECT
cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'BalanceUUID'
AS BalanceUUID,
cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'Units'
AS Cost
FROM cdrs
WHERE cost > 0
AND cost_details->'AccountSummary'->'BalanceSummaries' @>
'[{"ID":"B_MONETARY_POSTPAID"}]'
AND cost_details->'AccountSummary'->'BalanceSummaries' @>
json_build_object('UUID',
cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'BalanceUUID')::jsonb
limit 1;
ERROR: argument of AND must not return a set
LINE 1: ...ummaries' @> '[{"ID":"B_MONETARY_POSTPAID"}]' AND cost_detai...

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Browder 2019-08-29 11:57:37 Re: Anyone recommend omnidb.org?
Previous Message Gavin Henry 2019-08-28 23:32:47 Re: JSON query help