Re: Query on JSON field type

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Mick <m(dot)d(dot)berceanu(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Query on JSON field type
Date: 2012-11-15 17:00:27
Message-ID: CAHyXU0zwU31zwJfTb3kF+ST9KqjOf6SwKPnaK7aSCFbCCfgD_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Nov 14, 2012 at 4:27 PM, Mick <m(dot)d(dot)berceanu(at)gmail(dot)com> wrote:
> Hello,
> my field is called Samples and the value is {"R":100, "S":101, "Q":102}. how do I find all Samples for which "R" = 100?
> Thank you in advance.

for xml type we have xpath function for these type of queries.
unfortunately, no analog for json type exists as of yet. so, here our
our options:

*) pull to client side and filter there
*) search textually (say, by regular expression) and hope for the best
*) implement backend function in a language that speaks json, or can
be extended to do so. pl/v8 and p/python are both noteworthy, but
almost all languages have json features of some kind. your function
will do simple test and return bool for example.

merlin

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Cook, Brian - AIT 2012-11-15 17:59:07 How to add User with Read Only Access [INTERNAL]
Previous Message Igor Romanchenko 2012-11-15 13:52:18 Re: to_number function