Re: ALTER TABLE should change respective views

From: Archana Sundararam <archnasr(at)yahoo(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE should change respective views
Date: 2009-05-05 16:26:47
Message-ID: 61149.22703.qm@web33006.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks a lot. I thought I would go with writing a function to Drop the views , ALTER table and the recreate the views so as to take care of the column type changes in the table.

--- On Tue, 5/5/09, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [HACKERS] ALTER TABLE should change respective views
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, "Archana Sundararam" <archnasr(at)yahoo(dot)com>
Date: Tuesday, May 5, 2009, 8:10 AM

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> And this could then also change the return type of foo(), thus changing the
> row type of the view and would thus propogate up to other views.  And so if
> you have "many views", as you say, this could become a great mess.  You could
> probably define and implement a solution, but it would be very confusing and
> risky to use.

The SQL committee has also historically chosen to punt on such things.
Note the long-established rule that "*" is expanded at view definition
time (so adding columns doesn't change views).  I also see a flat
prohibition on *any* view reference in the newly added SET DATA TYPE
command (SQL:2008 11.17 <alter column data type clause>):

7) C shall not be referenced in the <query expression> of any view descriptor.

            regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Emmanuel Cecchet 2009-05-05 16:27:55 Wrong stats for empty tables
Previous Message Andrew Dunstan 2009-05-05 16:19:05 Re: bytea vs. pg_dump