From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Richard Huxton <dev(at)archonet(dot)com>, 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 20:35:35 |
Message-ID: | 20071101203534.GA31679@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Nov 01, 2007 at 02:22:58PM -0400, Tom Lane wrote:
> > SELECT random() FROM generate_series(1, 10) ORDER BY random();
> > SELECT random() AS foo FROM generate_series(1, 10) ORDER BY foo;
>
> (BTW, this is not the planner's fault; the collapsing of the two
> targetlist entries into one happens in the parser.)
Something twigged telling me that in fact the latter expression is not
in standard SQL but a (very common) extension. A <sort key> is clearly
indicated to be a <value expression> with no indication anywhere that
column aliases are allowed here (though that may be in the common rules
somewhere).
Then again, I may be remembering all wrong...
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2007-11-01 20:44:54 | Re: select random order by random |
Previous Message | Dawid Kuroczko | 2007-11-01 20:19:44 | Scrolling cursors in PL/PgSQL |