From: Bjorn T Johansen <btj@havleik.no>
To: pgsql-general@postgresql.org
Subject: jsonb and where clause?
Date: Tue, 28 Nov 2017 09:18:07 +0100
Message-ID: <20171128091807.218d7809@pennywise-btj> (raw)
Hi.
Just starting to look at how to use jsonb columns and I have a question. I have found out that I can use the following to search for a value inside
the jsonb column:
select * from orders where info ->> 'customer' = 'John Doe' (where info is the jsonb column)
But what if the jsonb column contains an json array, how can I search then?
info -> [ { "customer" : "John Doe" } ]
btw, using PostgreSQL 9.6 but will be moving to 10 soon.
Regards,
BTJ
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-general@postgresql.org
Cc: btj@havleik.no
Subject: Re: jsonb and where clause?
In-Reply-To: <20171128091807.218d7809@pennywise-btj>
References: <20171128091807.218d7809@pennywise-btj>
* 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