Re: How to search a string inside a json structure

From: Vick Khera <vivek(at)khera(dot)org>
To: sampie(at)iki(dot)fi
Cc: "Jason O'Donnell" <odonnelljp01(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to search a string inside a json structure
Date: 2015-11-03 15:57:15
Message-ID: CALd+dccU-2XjsL9km1aiLg6UYJz5mceyAs9Df6Zm255wpJV8mQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 3, 2015 at 10:07 AM, Sami Pietilä <sami(dot)pietila(at)gmail(dot)com>
wrote:

> Unfortunately I could not figure out how to select rows which, for
> example, contain following json: '{"a":"world","c":{"b":"helloworld"}}' by
> search with "hello" string.
>

cast the field to a text:

select * from t where myfield::text like '%hello%';

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2015-11-03 16:32:53 Re: Approach to extract top records from table based upon aggregate
Previous Message Sami Pietilä 2015-11-03 15:07:01 Re: How to search a string inside a json structure