Re: Re: [SQL] aliases break my query

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zeugswetter Andreas <andreas(dot)zeugswetter(at)telecom(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [SQL] aliases break my query
Date: 2000-05-26 22:30:14
Message-ID: Pine.LNX.4.21.0005270026540.348-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> "Zeugswetter Andreas" <andreas(dot)zeugswetter(at)telecom(dot)at> writes:
> > I think we could get agreement to not allow implicit from entries
> > if there is a from clause in the statement, but allow them if a from clause
> > is missing altogether.

That's what I had in mind.

> "Emit a notice [or error if you insist] when an implicit FROM item is
> added that refers to the same underlying table as any existing FROM
> item."

That's a step in the right direction, but I'd still like to catch

SELECT a.a1, b.b1 FROM a;

SELECT a.a1 FROM a WHERE a.a2 = b.b1;

both of which are more or less obviously incorrect and easily fixed.

> 95% of the complaints I can remember seeing were from people who got
> confused by the behavior of "FROM table alias" combined with a reference
> like "table.column". Seems to me the above rule would catch this case
> without being obtrusive in the useful cases. Comments?

--
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 Tom Lane 2000-05-26 22:42:03 Re: Re: [SQL] aliases break my query
Previous Message Tom Lane 2000-05-26 21:34:28 Re: Re: [SQL] aliases break my query

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-05-26 22:42:03 Re: Re: [SQL] aliases break my query
Previous Message Tom Lane 2000-05-26 21:34:28 Re: Re: [SQL] aliases break my query