pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: avalon@teleweb.at
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] SELECT multiple tables with same fields
Date: Sun, 29 Aug 1999 13:02:32 -0400
Message-ID: <12276.935946152@sss.pgh.pa.us> (raw)
In-Reply-To: <37C95508.B50F49BD@AVALON.at>

"Dipl.-Ing. Thomas Schallar" <T.Schallar@AVALON.at> writes:
> Before I started programming with Postgres I've done my stuff with
> Microsoft Visual Basic and Access. Access has the lovely feature, that
> doubly selected column names are automatically renamed to
> <tablename>.<columname> (or <tablename>_<columname>? I can't remember at
> the moment; sorry!) so everything works fine.

Hmm.  That is arguably a violation of SQL92: the spec says

         9) Case:

            a) If the i-th <derived column> in the <select list> specifies
              an <as clause> that contains a <column name> C, then the
              <column name> of the i-th column of the result is C.

            b) If the i-th <derived column> in the <select list> does not
              specify an <as clause> and the <value expression> of that
              <derived column> is a single <column reference>, then the
              <column name> of the i-th column of the result is C.

		["C" here apparently refers to the <column name> within
		 the <column reference> --- tgl]

            c) Otherwise, the <column name> of the i-th column of the <query
              specification> is implementation-dependent and different
              from the <column name> of any column, other than itself, of
              a table referenced by any <table reference> contained in the
              SQL-statement.

So, it appears to me that an implementation has flexibility about the
column name to assign to an expression result, but none about the name
to assign to a simple variable reference.

Which is too bad, because I agree that assigning nonduplicate column
names would be more useful behavior...

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <12276.935946152@sss.pgh.pa.us>
Permalink:  ../12276.935946152@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12276.935946152@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 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: tgl@sss.pgh.pa.us, avalon@teleweb.at
  Subject: Re: [SQL] SELECT multiple tables with same fields
  In-Reply-To: <12276.935946152@sss.pgh.pa.us>
  References: <37C95508.B50F49BD@AVALON.at> <12276.935946152@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