Re: Improper processing of random values in sub-queries - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Improper processing of random values in sub-queries
Date
Msg-id 2071.1089428535@sss.pgh.pa.us
Whole thread Raw
In response to Improper processing of random values in sub-queries  (David Newall <davidn-postgres@rebel.net.au>)
Responses Re: Improper processing of random values in sub-queries
List pgsql-bugs
David Newall <davidn-postgres@rebel.net.au> writes:
> NOW CONSIDER the following query, executed using psql:

> SELECT i, j from (
>   SELECT i, ((i + 18 * random())::integer % 20 + 1) AS j FROM data
> ) foo WHERE j = 15;

Hmph.  Evidently the planner should refuse to flatten subselects that
have volatile functions in their output list (and perhaps anywhere
else??).  This will probably make some people unhappy, but I see no
other fix.

I assume though that this is a made-up example and is not the case
that's really troubling you.  What is the actual problem you are looking
at?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1188: evaluation order of select seems to be wrong
Next
From: Tom Lane
Date:
Subject: Re: Fwd: postgresql-autodoc - missinterprets "version"