pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christian Rudow <Christian.Rudow@thinx.ch>
Cc: PostgreSQL SQL <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Using Aliases in Select
Date: Mon, 02 Aug 1999 10:06:13 -0400
Message-ID: <2928.933602773@sss.pgh.pa.us> (raw)
In-Reply-To: <37A59B9C.79D5C4FB@thinx.ch>

Christian Rudow <Christian.Rudow@thinx.ch> writes:
> select tab1.name, tab1.mytext text1, tab2.mytext text2
> from tab1, tab2
> where tab1.tab1_id = tab2.tab1_id
> ERROR:  Column 'mytext' is ambiguous

As Oleg points out, you need to write AS text1 and so forth.  The AS
is not optional when labeling output columns, even though you are
allowed to leave it out in the FROM list.  But I am wondering about
the error message --- all the Postgres versions that I have say
	ERROR:  parser: parse error at or near "text1"
which may not be too helpful but at least it's not outright
misleading.  What version are you using?

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <2928.933602773@sss.pgh.pa.us>
Permalink:  ../2928.933602773@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2928.933602773@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, Christian.Rudow@thinx.ch
  Subject: Re: [SQL] Using Aliases in Select
  In-Reply-To: <2928.933602773@sss.pgh.pa.us>
  References: <37A59B9C.79D5C4FB@thinx.ch> <2928.933602773@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