Re: Lag and lead window functions order by weirdness - Mailing list pgsql-sql

From Tim Landscheidt
Subject Re: Lag and lead window functions order by weirdness
Date
Msg-id m31vl0r6g5.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to Re: Lag and lead window functions order by weirdness  (Thom Brown <thombrown@gmail.com>)
List pgsql-sql
Thom Brown <thombrown@gmail.com> wrote:

> [...]
> Having a look around, it looks as if Postgres might be misbehaving.
>  According to this page,
> http://my.safaribooksonline.com/0596004818/sqlnut2-CHP-4-SECT-3, the ORDER
> BY in the window function's clause shouldn't be having this ordering effect:

> "Furthermore, the order within these groups is defined by an ordering
> clause, but that order only affects function evaluation, and has no effect
> on the order in which rows are returned by the query."

> The behaviour is unexpected from my perspective, but obviously there are
> workarounds.  Is anyone able to confirm any of this?

AFAIR, others have already pointed out that without an "OR-
DER BY" clause PostgreSQL can return the result set in *any*
"order" it deems fit. So why don't you use one?

Tim



pgsql-sql by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Efficiency in Multiple Queries of Same Table in a PL/PgSQL Function
Next
From: "Oliveiros C,"
Date:
Subject: Re: How to order varchar data by word