Re: JSON query help

From: Gavin Henry <gavin(dot)henry(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: JSON query help
Date: 2019-08-28 19:40:04
Message-ID: CAA8_NKBwNeYmoAVHicePw9j_H+D2uewBXUHjqwQP4_TcqAjNfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I think I'm pretty close:

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' @>
jsonb_build_object('UUID'::text,
cost_details->'Accounting'->jsonb_object_keys(cost_details->'Accounting')->'BalanceUUID')::jsonb
LIMIT 1;

ERROR: function jsonb_build_object(text, jsonb) does not exist
LINE 1: ..._details->'AccountSummary'->'BalanceSummaries' @> jsonb_buil...
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2019-08-28 19:55:03 Re: JSON query help
Previous Message Gavin Henry 2019-08-27 21:26:37 Re: JSON query help