Bruno Wolff III <[EMAIL PROTECTED]> writes:
> Specifically the interpretation I think makes sense is that
> SELECT DISTINCT ON (a, b, c) * FROM tablename ORDER BY d, e, f
> should be treated as equvialent to
> SELECT * FROM
> (SELECT DISTINCT ON (a, b, c) FROM tablename ORDER BY a, b, c, d, e, f)
On Mon, Dec 15, 2003 at 06:14:59 -0600,
Bruno Wolff III <[EMAIL PROTECTED]> wrote:
>
> Doing things as above is pretty much the same as normal distinct on
> for purposes of which rows get selected. Of the possible rows that
> might get returned for a specific set of values from the distinct on
>
On Sun, Dec 14, 2003 at 22:17:35 -0500,
Tom Lane <[EMAIL PROTECTED]> wrote:
> Bruno Wolff III <[EMAIL PROTECTED]> writes:
> > If the sort used to select the records sorts on both the distinct
> > expressions and the order by expressions you will get a sensible
> > deterministic result.
>
> Sensi
Bruno Wolff III <[EMAIL PROTECTED]> writes:
> If the sort used to select the records sorts on both the distinct
> expressions and the order by expressions you will get a sensible
> deterministic result.
Sensible in what sense? ;-)
It seems to me that the existing documentation defines the behavi
Neil Conway <[EMAIL PROTECTED]> writes:
> Does the non-determinism you're referring to result from an ORDER BY
> on a non-deterministic expression, or the non-determinism that results
> from picking an effectively random row because the ORDER BY isn't
> sufficient?
The latter --- you don't know wh
On Sun, Dec 14, 2003 at 18:09:33 -0500,
Tom Lane <[EMAIL PROTECTED]> wrote:
>
> This was discussed before --- see the archives. I believe the
> conclusion was that the results would actually be nondeterministic
> if we used two sort steps (that's what the code comment means by
> "rather unpredi
Tom Lane <[EMAIL PROTECTED]> writes:
> This was discussed before --- see the archives. I believe the
> conclusion was that the results would actually be nondeterministic
> if we used two sort steps (that's what the code comment means by
> "rather unpredictable").
Does the non-determinism you're r
Greg Stark <[EMAIL PROTECTED]> writes:
> So, like DISTINCT ON, GROUP BY also insists on the user providing the
> ORDER BY clause. I suppose you could argue postgres could implicitly
> introduce an extra sort step when the user-provided ORDER BY doesn't
> match the GROUP BY or DISTINCT ON clause but
On Sat, Dec 13, 2003 at 22:12:32 -0500,
Greg Stark <[EMAIL PROTECTED]> wrote:
>
> So, like DISTINCT ON, GROUP BY also insists on the user providing the ORDER BY
> clause. I suppose you could argue postgres could implicitly introduce an extra
> sort step when the user-provided ORDER BY doesn't ma
Greg Stark <[EMAIL PROTECTED]> writes:
> Do you really want:
>
> select distinct on (b,c,a) a,b,c from abc order by b,c,a;
>
> or is that you want
>
> select * from (select distinct on (a) a,b,c order by a) order by
> b,c,a;
If I understand you correctly, I don't think I would expect either.
-
Neil Conway <[EMAIL PROTECTED]> writes:
> We reject the following query:
>
> nconway=# create table abc (a int, b int, c int);
> CREATE TABLE
> nconway=# select distinct on (a) a, b, c from abc order by b, c, a;
> ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY
> expressions
W
On Fri, Dec 12, 2003 at 18:39:20 -0500,
Neil Conway <[EMAIL PROTECTED]> wrote:
> /*
>* If the user writes both DISTINCT ON and ORDER BY, then the
>* two expression lists must match (until one or the other
>* runs out). Otherwise the O
We reject the following query:
nconway=# create table abc (a int, b int, c int);
CREATE TABLE
nconway=# select distinct on (a) a, b, c from abc order by b, c, a;
ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY
expressions
This works fine, of course:
nconway=# select distinct o
13 matches
Mail list logo