Re: Aggregates with non-commutative transition functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Emmanuel Charpentier <charpent(at)bacbuc(dot)dyndns(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Aggregates with non-commutative transition functions
Date: 2003-02-14 00:10:58
Message-ID: 2214.1045181458@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Emmanuel Charpentier <charpent(at)bacbuc(dot)dyndns(dot)org> writes:
> In other words, may I guarantee that :
> select recnum, glue(linenum)as authors from (select recnum, linenum, author
> from cit_authors where <some conditions on recnum> order by recnum,
> linenum) as foo;
> will indeed give me the authors in the original order ?

The query as given is illegal; you'd need to add "GROUP BY recnum" to
the outer query to make it legal. And once you do that, I don't think
you can rely on the ordering of the rows.

This problem has been discussed before, and I think we came up with some
workaround for it, but I don't have time to go trolling the archives for
the solution at the moment.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-02-14 01:04:07 Re: index scan with index cond on first column doesn't recognize sort order of second column
Previous Message Tom Lane 2003-02-14 00:01:30 Re: set returning functions in v7.3