From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: add_missing_from breaks existing views |
Date: | 2005-10-26 19:35:20 |
Message-ID: | 10806.1130355320@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> Neil Conway <neilc(at)samurai(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-10-26 19:39:37 | Re: pidfile location missing after restarting crashed server in 8.1 |
Previous Message | Andrew - Supernews | 2005-10-26 19:33:48 | Re: add_missing_from breaks existing views |