Re: [SQL] aliases break my query - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [SQL] aliases break my query
Date
Msg-id Pine.GSO.4.02A.10005261453420.12244-100000@Falk.DoCS.UU.SE
Whole thread Raw
List pgsql-hackers
> > 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@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Increasing row size beyond 8k
Next
From: CB
Date:
Subject: Probably already asked but