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

From Tom Lane
Subject Re: Re: [SQL] aliases break my query
Date
Msg-id 3941.959380923@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: [SQL] aliases break my query  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
>> "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.

More or less obviously nonstandard, you mean.  It's unlikely that
either of those examples are incorrect in the sense of not doing what
the user expected them to.

If we were working in a green field then I'd agree that we ought to be
100% SQL-spec-compliant on this point.  But as is, we are talking about
rejecting an extension that Postgres has always had and a lot of people
find useful.  I'm not eager to do that; I think it'd be putting pedantry
ahead of usefulness and backwards-compatibility.  What I want to see is
the minimum restriction that will catch likely errors, not an "I'll
annoy you until you change your queries to meet the letter of the spec"
kind of message.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Re: [SQL] aliases break my query
Next
From: "Andy Joseph"
Date:
Subject: where is libpq-fe.h