Skip site navigation (1) Skip section navigation (2)

Re: aliases break my query

From: Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joseph Shraibman <jks(at)selectacast(dot)net>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: aliases break my query
Date: 2000-05-26 13:02:53
Message-ID: Pine.GSO.4.02A.10005261453420.12244-100000@Falk.DoCS.UU.SE (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
> > playpen=> select ta.a,ta.b,ta.c, (select count (tb.zz) where tb.yy =
> > ta.a) from tablea ta, tableb tb order by tablea.a;
> [ produces 80 rows ]

> > playpen=> select ta.a,ta.b,ta.c, (select count (tb.zz) where tb.yy =
> > ta.a) from tablea ta, tableb tb order by ta.a;
> [ produces 20 rows ]

> > playpen=> select tablea.a,tablea.b,tablea.c, (select count (tableb.zz)
> > where tableb.yy = tablea.a) order by tablea.a;
> [ produces 4 rows ]

Once again, I think that we *really* need to discuss whether implicit
range table entries in SELECT are a good idea. We invariably get a
question like this every week and invariably the answer is "if you give a
table an alias you *must* refer to it by that alias". (I'm sure Tom has
this reply automated by now.) I claim the only thing that buys is
confusion for very little convenience at the other end.

Stop the madness! :)

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e(at)gmx(dot)net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


In response to

Responses

pgsql-hackers by date

Next:From: Nishad PRAKASHDate: 2000-05-26 14:18:01
Subject: Re: \dS and \df <pattern> crashing psql
Previous:From: Tatsuo IshiiDate: 2000-05-26 12:20:12
Subject: Re: syslog fix

pgsql-sql by date

Next:From: Ed LoehrDate: 2000-05-26 13:42:36
Subject: Re: PG/DBI: 'NOTICE: UserAbortTransactionBlock and not in in-progress state'
Previous:From: Peter EisentrautDate: 2000-05-26 12:48:06
Subject: Re: A Question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group