Re: add_missing_from breaks existing views

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: andrew(at)supernews(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: add_missing_from breaks existing views
Date: 2005-10-26 14:58:30
Message-ID: 200510261458.j9QEwUR15641@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Should we allow CREATE VIEW to run with "add_missing_from = true" until
we fix CREATE VIEW to handle this cleanly? We emit a warning when we
add a missing FROM too, as I remember.

---------------------------------------------------------------------------

Andrew - Supernews wrote:
> On 2005-10-26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Andrew - Supernews <andrew+nonews(at)supernews(dot)com> writes:
> >> On 2005-10-26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >>> Uh, no ... the global setting of add_missing_from does *not* tell you
> >>> anything about whether there exist views in the database that were
> >>> created under a different setting.
> >
> >> I realize that; but is it also not the case that someone who creates a
> >> view that requires add_missing_from, and then turns it off, has _already_
> >> broken dump+restore on his own database?
> >
> > No, because we consider that a client-local setting. This argument is
> > akin to saying that if a client loads some data with client_encoding FOO
> > into a database with server_encoding BAR, we are not responsible for
> > dumping and reloading the data correctly.
>
> 8.0:
>
> test=# show add_missing_from;
> add_missing_from
> ------------------
> off
> (1 row)
>
> test=# set add_missing_from to true;
> SET
> test=# create view v1 as select test.*;
> CREATE VIEW
> test=# \q
>
> % pg_dump -U pgsql -s -d test | psql -U pgsql -d test2
>
> [...]
> ERROR: missing FROM-clause entry for table "test"
> ERROR: relation "public.v1" does not exist
>
> Looks broken to me.
>
> I wasn't arguing that the broken behaviour was correct, merely that it
> exists.
>
> > In hindsight I think there's no doubt that we blew it in not making
> > ruleutils.c reverse-list implicit RTEs some time ago.
>
> Obviously. Isn't hindsight wonderful.
>
> > Pretending it's the user's mistake isn't
> > an answer that fits down my craw very well...
>
> I'm not claiming it's the user's mistake. My point is that if the user
> did in fact remove add_missing_from after creating views that depend on it,
> then they have already run into a bug.
>
> --
> Andrew, Supernews
> http://www.supernews.com - individual and corporate NNTP services
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-26 15:07:58 Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals
Previous Message Bruce Momjian 2005-10-26 14:49:12 Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals