Chris Browne wrote:
> If I replicate your query, with extra columns, AND NAMES, I get the following:
>
> [EMAIL PROTECTED]:5433=# select random() as r1, random() as r2, random() as
> r3 from generate_series(1,10) order by random();
> r1 | r2 |r3
>
On Nov 1, 2007, at 18:57, Tom Lane wrote:
In the usual tradition of SQL99, the spec text is enormously less
readable than SQL92 was, but I *think* this says nearly the same thing
as what we do: a plain column reference in ORDER BY is first sought as
an output column name, and failing that sough
Gregory Stark <[EMAIL PROTECTED]> writes:
> So I guess having the parser do this substitution kind of makes sense
> if you're thinking about things the way the spec does. It doesn't make
> much sense if you're thinking the way Postgres does of having
> arbitrary expressions there independent of wha
"Scott Marlowe" <[EMAIL PROTECTED]> writes:
> On 11/1/07, Martijn van Oosterhout <[EMAIL PROTECTED]> wrote:
>> 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
Martijn van Oosterhout <[EMAIL PROTECTED]> writes:
> Something twigged telling me that in fact the latter expression is not
> in standard SQL but a (very common) extension. A is clearly
> indicated to be a with no indication anywhere that
> column aliases are allowed here (though that may be in t
On 11/1/07, Martijn van Oosterhout <[EMAIL PROTECTED]> wrote:
> 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
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 on
On Thursday 01 November 2007 17:16, Scott Marlowe wrote:
> > > I was very surprised when I executed such SQL query (under PostgreSQL
> > > 8.2):
> > > select random() from generate_series(1, 10) order by random();
> > >
> (...)
> My guess is that it was recognized by the planner as the same functi
On Thursday 01 November 2007 17:08, brian wrote:
> > I was very surprised when I executed such SQL query (under PostgreSQL
> > 8.2): select random() from generate_series(1, 10) order by random();
> >
> > I don't understand - why the result is like that? It seems like in each
> > row both random()s
Richard Huxton <[EMAIL PROTECTED]> 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 rand
On Thu, Nov 01, 2007 at 04:49:16PM +, Richard Huxton wrote:
> 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 equ
Gregory Stark wrote:
"Scott Marlowe" <[EMAIL PROTECTED]> writes:
I think that Piotr expected the random() to be evaluated in both
places separately.
My guess is that it was recognized by the planner as the same function
and evaluated once per row only.
If you try this:
select random() from g
"Scott Marlowe" <[EMAIL PROTECTED]> writes:
> I think that Piotr expected the random() to be evaluated in both
> places separately.
>
> My guess is that it was recognized by the planner as the same function
> and evaluated once per row only.
>
> If you try this:
>
> select random() from generate_s
On 11/1/07, Lee Keel <[EMAIL PROTECTED]> wrote:
> > Dear sirs,
> >
> > I was very surprised when I executed such SQL query (under PostgreSQL
> > 8.2):
> > select random() from generate_series(1, 10) order by random();
> >
> > I thought I would receive ten random numbers in random order. But I
> > r
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pgsql-general-
> [EMAIL PROTECTED] On Behalf Of piotr_sobolewski
> Sent: Thursday, November 01, 2007 9:25 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] select random order by random
>
> De
piotr_sobolewski wrote:
Dear sirs,
I was very surprised when I executed such SQL query (under PostgreSQL 8.2):
select random() from generate_series(1, 10) order by random();
I thought I would receive ten random numbers in random order. But I received
ten random numbers sorted numerically:
Dear sirs,
I was very surprised when I executed such SQL query (under PostgreSQL 8.2):
select random() from generate_series(1, 10) order by random();
I thought I would receive ten random numbers in random order. But I received
ten random numbers sorted numerically:
random
17 matches
Mail list logo