pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Don Baccus <dhogaza@pacifier.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Philip Warner <pjw@rhyme.com.au>
Cc: Chris Bitmead <chris@bitmead.com>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
Date: Mon, 24 Jan 2000 21:20:22 -0800
Message-ID: <3.0.1.32.20000124212022.00f70720@mail.pacifier.com> (raw)
In-Reply-To: <11879.948776470@sss.pgh.pa.us>
References: <3.0.5.32.20000125150557.036121c0@mail.rhyme.com.au>
	<2295.948765015@sss.pgh.pa.us>
	<3.0.5.32.20000125140349.035768d0@mail.rhyme.com.au>
	<3.0.5.32.20000125150557.036121c0@mail.rhyme.com.au>

At 12:01 AM 1/25/00 -0500, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> Just a thought, but would I be right in saying that this could be easily
>> done with the addition of a new aggregate function 'FIRST', which simply
>> returns the first value sent to it? Since the aggregates operate a row at
>> a time, you are guaranteed a consistent set of values, I think.
>
>No, because the system doesn't guarantee to deliver tuples to the
>aggregate in any particular order.

In fact, this is a KEY notion behind RDBMS systems...queries return an
unordered set, pure and simple, unless you supply an "order" clause
(though "group by" appears to be implemented by ordering in various 
RDBMS systems, that's an efficiency hack not a given AFAIK).

>SQL in general doesn't believe that tuple ordering has any semantic
>significance --- you can ask for ORDER BY, but that's only honored
>at the end stage of SELECT result delivery, not necessarily anywhere
>in the bowels of a query.

Yep...



- Don Baccus, Portland OR <dhogaza@pacifier.com>
  Nature photos, on-line guides, Pacific Northwest
  Rare Bird Alert Service and other goodies at
  http://donb.photo.net.



view thread (36+ messages)  latest in thread

Message-ID: <3.0.1.32.20000124212022.00f70720@mail.pacifier.com>
Permalink:  ../3.0.1.32.20000124212022.00f70720@mail.pacifier.com/
Also on:    postgresql.org/message-id/3.0.1.32.20000124212022.00f70720@mail.pacifier.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: dhogaza@pacifier.com, tgl@sss.pgh.pa.us, pjw@rhyme.com.au, chris@bitmead.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
  In-Reply-To: <3.0.1.32.20000124212022.00f70720@mail.pacifier.com>
  References: <3.0.5.32.20000125150557.036121c0@mail.rhyme.com.au> <2295.948765015@sss.pgh.pa.us> <3.0.5.32.20000125140349.035768d0@mail.rhyme.com.au> <3.0.1.32.20000124212022.00f70720@mail.pacifier.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox