Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVIN G

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'pgsql-hackers(at)postgreSQL(dot)org'" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVIN G
Date: 1999-12-16 14:52:26
Message-ID: 219F68D65015D011A8E000006F8590C603FDC1CE@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
> > Informix and DB/2 allow column numbering in the group by clause.
>
> What do they do with
>
> SELECT foo AS bar FROM table GROUP BY bar
>
> What do they do if bar is the real name of another column in
> the table?

They don't allow labels, only numbers,
(SELECT foo AS bar FROM table GROUP BY 1)

In the special case where a label collides with a colname,
we need to use the colname, because that behavior is
ruled by the standard (since it doesn't allow a label).

The order by clause is the other way around.

DB Vendors probably disallow this syntax,
because the two different interpretations would be a bit awkward.

Best would of course be if the standard allowed labels in the
group by and where clause and take label before colname.

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Nappe 1999-12-16 15:49:26 Arrays and pg_groupr
Previous Message Tom Lane 1999-12-16 14:46:11 Re: [HACKERS] Finding corrupt data