From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Gregory Stark <stark(at)enterprisedb(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Lee Keel <lee(dot)keel(at)uai(dot)com>, piotr_sobolewski <piotr_sobolewski(at)o2(dot)pl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: select random order by random |
Date: | 2007-11-01 18:22:58 |
Message-ID: | 9570.1193941378@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Huxton <dev(at)archonet(dot)com> writes:
> Gregory Stark wrote:
>> This does strike me as wrong. random() is marked volatile and the planner
>> ought not collapse multiple calls into one.
> I think I agree with the earlier poster. Surely these two queries should
> be equivalent?
> SELECT random() FROM generate_series(1, 10) ORDER BY random();
> SELECT random() AS foo FROM generate_series(1, 10) ORDER BY foo;
Well, the latter case is why it acts that way, but Greg has a point that
when a volatile function is involved maybe they shouldn't be the same.
OTOH it's always been like that, and in the absence of a clear reason
to change it I'm inclined to leave it alone.
(BTW, this is not the planner's fault; the collapsing of the two
targetlist entries into one happens in the parser.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-11-01 18:27:43 | Re: Solaris 10, mod_auth_pgsql2 |
Previous Message | Sam Mason | 2007-11-01 18:07:12 | Re: select random order by random |