Re: Improper processing of random values in sub-queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Newall <davidn-postgres(at)rebel(dot)net(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Improper processing of random values in sub-queries
Date: 2004-07-10 03:02:15
Message-ID: 2071.1089428535@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Newall <davidn-postgres(at)rebel(dot)net(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-07-10 03:58:27 Re: Fwd: postgresql-autodoc - missinterprets "version"
Previous Message Tom Lane 2004-07-10 02:27:42 Re: BUG #1188: evaluation order of select seems to be wrong