querying within json
| От | Tim Dudgeon |
|---|---|
| Тема | querying within json |
| Дата | |
| Msg-id | CAP=hSSfiqaxt7NFi8qUEjKrH=te_cFXDfOfZ9PYEhcJRC+oGMg@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: querying within json
|
| Список | pgsql-sql |
<div dir="ltr">Any advice on how to best query for values within json (using 9.4). I have numeric fields within the jsonand want to include terms for those fields.<br /><br /> I've found that something like this works:<br /><br /> select* from atable where (json_col->>'numeric_prop')::numeric < 100;<br /><br /> But whilst that works:<br /> 1.seems to have unnecessary casts? The numeric _prop item is of numeric type, but its getting retrieved as text and thencast to numeric and then compared<br /> 2. its not going to use any index on the json_col jsonb column.<br /><br /> Isthere a better way to do this?<br /><br /><br /> Thanks<br /> Tim<br /></div>
В списке pgsql-sql по дате отправления: