Re: How to search a string inside a json structure - Mailing list pgsql-general

From Vick Khera
Subject Re: How to search a string inside a json structure
Date
Msg-id CALd+dccU-2XjsL9km1aiLg6UYJz5mceyAs9Df6Zm255wpJV8mQ@mail.gmail.com
Whole thread Raw
In response to Re: How to search a string inside a json structure  (Sami Pietilä <sami.pietila@gmail.com>)
Responses Re: How to search a string inside a json structure  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general

On Tue, Nov 3, 2015 at 10:07 AM, Sami Pietilä <sami.pietila@gmail.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%';

pgsql-general by date:

Previous
From: Sami Pietilä
Date:
Subject: Re: How to search a string inside a json structure
Next
From: Merlin Moncure
Date:
Subject: Re: Approach to extract top records from table based upon aggregate