pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: Lista dyskusyjna pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: column alias and group by/having/order
Date: Fri, 13 Feb 2004 10:15:31 -0500
Message-ID: <2373.1076685331@sss.pgh.pa.us> (raw)
In-Reply-To: <402CD27E.7050001@klaster.net>
References: <402CD27E.7050001@klaster.net>

Tomasz Myrta <jasiek@klaster.net> writes:
> I found some strange column alias behaviour:

That's how it is.  The fact that you can reference output-column aliases
at all in GROUP BY or ORDER BY is a wart, because it conflicts with the
logical model of query evaluation --- the output list should be computed
last.  We have extended the SQL92 requirement (unadorned aliases in
ORDER BY) to allow the same in GROUP BY, but we don't take it to the
level of allowing them inside arbitrary expressions.

			regards, tom lane



view thread (3+ messages)

Message-ID: <2373.1076685331@sss.pgh.pa.us>
Permalink:  ../2373.1076685331@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2373.1076685331@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, jasiek@klaster.net
  Subject: Re: column alias and group by/having/order
  In-Reply-To: <2373.1076685331@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