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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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

Browse pgsql-hackers by date

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

Browse pgsql-sql by date

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