Re: JSON and Postgres Variable Queries - Mailing list pgsql-hackers

From Tom Lane
Subject Re: JSON and Postgres Variable Queries
Date
Msg-id 16964.1403540219@sss.pgh.pa.us
Whole thread Raw
In response to Re: JSON and Postgres Variable Queries  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: How about a proper TEMPORARY TABLESPACE?
Next
From: "MauMau"
Date:
Subject: Re: Use a signal to trigger a memory context dump?