pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Frank Bax <fbax@sympatico.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: simple? join
Date: Mon, 07 Jan 2002 18:25:41 -0500
Message-ID: <15059.1010445941@sss.pgh.pa.us> (raw)
In-Reply-To: <3.0.6.32.20020107170828.0099e8b0@pop6.sympatico.ca>
References: <3.0.6.32.20020104121000.00996cb0@pop6.sympatico.ca>
	<3.0.6.32.20020107170828.0099e8b0@pop6.sympatico.ca>

Frank Bax <fbax@sympatico.ca> writes:
> But first and last can't be duplicated if emp is defined as unique.  If I
> am also selecting a dozen or so other fields from "employee" table, must I
> also include them all in the GROUP BY clause, even though I know "emp"
> identifies a unique row in this table?

SQL92 says you must.

SQL99, however, seems to understand the concept you are putting forward.
If I understand what they're getting at, the notion of "functional
dependency" that is defined at excruciating length in SQL99 is
essentially that a unique key functionally determines all the other
columns in its table.  And the places where SQL92 says something like
"shall reference a grouping column of T or shall be specified within a
<set function specification>" are changed in SQL99 to read "shall
reference a column that is functionally dependent on G or shall be
specified within a <set function specification>" (G being the set of
grouping columns).

Also, SQL99 considers this an optional feature:

         3) Without Feature T301, "Functional dependencies", if T is
            a grouped table, then in each <value expression>, each
            <column reference> that references a column of T shall
            reference a grouping column or be specified in a <set function
            specification>.

So, when and if we get around to implementing this particular SQL99
feature, what you are suggesting will work.  Right now it doesn't
(and I'll wager that darn few other SQL implementations support this
feature as yet, either).

BTW, SQL99's GROUP BY clause seems to have a whole bunch of baroque
new features besides this one.

			regards, tom lane



view thread (25+ messages)  latest in thread

Message-ID: <15059.1010445941@sss.pgh.pa.us>
Permalink:  ../15059.1010445941@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15059.1010445941@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, fbax@sympatico.ca
  Subject: Re: simple? join
  In-Reply-To: <15059.1010445941@sss.pgh.pa.us>

* 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