Re: JSON and Postgres Variable Queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Joey Caughey <jcaughey(at)parrotmarketing(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, gkimball(at)parrotmarketing(dot)com
Subject: Re: JSON and Postgres Variable Queries
Date: 2014-06-23 16:16:59
Message-ID: 16964.1403540219@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> 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's
> problematic for some reason that I don't know about,

Standards compliance? It's not just a trivial syntactic issue either,
but a rather fundamental conceptual one: expressions in the target list
are not supposed to be evaluated until after the WHERE clause is.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-06-23 16:17:00 Re: How about a proper TEMPORARY TABLESPACE?
Previous Message Tom Lane 2014-06-23 16:08:44 Re: Re: [bug fix] multibyte messages are displayed incorrectly on the client