Re: [HACKERS] JSON and Postgres Variable Queries

2014-06-23 Thread Tom Lane
Robert Haas writes: > You might find a sub-SELECT helpful: > SELECT * FROM (SELECT json_data->>’plan'->>’id' as plan_id FROM > orders) x WHERE plan_id = 1 > It might be a generally useful thing for WHERE-clause items to be able > to reference items from the target list by alias, or maybe it'

Re: [HACKERS] JSON and Postgres Variable Queries

2014-06-23 Thread Andrew Dunstan
On 06/23/2014 11:06 AM, Robert Haas wrote: On Fri, Jun 20, 2014 at 11:26 AM, Joey Caughey wrote: I’m having an issue with JSON requests in Postgres and was wondering if anyone had an answer. I have an orders table with a field called “json_data”. In the json data there is a plan’s array with

Re: [HACKERS] JSON and Postgres Variable Queries

2014-06-23 Thread Robert Haas
On Fri, Jun 20, 2014 at 11:26 AM, Joey Caughey wrote: > I’m having an issue with JSON requests in Postgres and was wondering if > anyone had an answer. > > I have an orders table with a field called “json_data”. > > In the json data there is a plan’s array with an id value in them. > { "plan”: { “

Re: [HACKERS] JSON and Postgres Variable Queries

2014-06-20 Thread Andrew Dunstan
On 06/20/2014 11:26 AM, Joey Caughey wrote: I’m having an issue with JSON requests in Postgres and was wondering if anyone had an answer. I have an orders table with a field called “json_data”. In the json data there is a plan’s array with an id value in them. { "plan”: { “id”: “1” } } } I c