Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJb5o-00033f-T3 for pgsql-general@arkaria.postgresql.org; Tue, 28 Nov 2017 08:18:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJb5o-0005PN-FU for pgsql-general@arkaria.postgresql.org; Tue, 28 Nov 2017 08:18:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eJb5o-0005PD-8M for pgsql-general@lists.postgresql.org; Tue, 28 Nov 2017 08:18:12 +0000 Received: from smtp.nspdc.no ([185.161.76.37]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eJb5k-0003Ni-Qb for pgsql-general@postgresql.org; Tue, 28 Nov 2017 08:18:11 +0000 Date: Tue, 28 Nov 2017 09:18:07 +0100 From: Bjorn T Johansen To: pgsql-general@postgresql.org Subject: jsonb and where clause? Message-ID: <20171128091807.218d7809@pennywise-btj> Organization: Havleik Consulting X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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