Re: querying within json

From: Tim Dudgeon <tdudgeon(dot)ml(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: querying within json
Date: 2014-10-30 19:22:07
Message-ID: 54528FDF.6070807@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On 30/10/2014 16:48, David G Johnston wrote:
>>> CREATE INDEX idxgin_numeric_prop ON atable USING
>>> gin((json_col->'numeric_prop'));
>> I can add the index, but no evidence of it being used when I run a query
>> like this:
>> select * from atable where (json_col->>'numeric_prop')::numeric < 100;
> The index is storing text while the expression has been cast to numeric so,
> no, if what is shown above is exactly what you did then you would not be
> using the index.

So I tried to create the index to make it a numeric index using a cast
(won't show the failed details) but failed.
Any suggestions on how to do this?

Tim
>
>
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/querying-within-json-tp5825042p5825055.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2014-10-31 14:58:06 INT8 / float casting question
Previous Message Andreas Kretschmer 2014-10-30 17:45:55 Re: return encoding results