Re: add_missing_from breaks existing views - Mailing list pgsql-hackers

From Tom Lane
Subject Re: add_missing_from breaks existing views
Date
Msg-id 10806.1130355320@sss.pgh.pa.us
Whole thread Raw
In response to Re: add_missing_from breaks existing views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> Neil Conway <neilc@samurai.com> writes:
>> On Tue, 2005-25-10 at 17:43 -0400, Tom Lane wrote:
>>> What I suggest we do about this is change addImplicitRTE() to set
>>> inFromCl true for implicitly added RTEs, so that the view rule will
>>> later be dumped as if the query had been written per spec.

>> Sounds reasonable. I wonder if this should be backpatched -- ISTM the
>> proper representation of the view is with an explicit FROM list anyway,

> I think it'd be reasonable to back-patch it into the branches that have
> the add_missing_from variable (how far back did we add that?).

I've committed the change, but only in HEAD.  Even as late as 8.0,
it makes the regression tests fail all over the place, because
warnAutoRange gets confused (it's depending on the old behavior
of inFromCl).  We could possibly rejigger the code to avoid this,
but I think the wiser course is to leave the back branches alone.

BTW, I noticed an interesting factoid: addImplicitRTE was never modified
to obey the SQL_inheritance parameter, so you always get an ONLY
reference:

regression=# set add_missing_from TO 1;
SET
regression=# create view vv as select int8_tbl.*;
NOTICE:  adding missing FROM-clause entry for table "int8_tbl"
CREATE VIEW
regression=# \d vv     View "public.vv"Column |  Type  | Modifiers
--------+--------+-----------q1     | bigint |q2     | bigint |
View definition:SELECT int8_tbl.q1, int8_tbl.q2  FROM ONLY int8_tbl;

Considering that this is strictly a legacy feature, we probably should
not change its behavior now ... but it does seem a tad inconsistent.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew - Supernews
Date:
Subject: Re: add_missing_from breaks existing views
Next
From: Tom Lane
Date:
Subject: Re: pidfile location missing after restarting crashed server in 8.1