Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Date
Msg-id 20140602181029.GE5146@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> Oh, I quite agree with that.  My concern here has to do with automatically
> and silently making changes that we can't be very sure will meet the
> user's expectations.  Perhaps what we need is some kind of UI/API design
> whereby the user can inspect/modify/approve the semantic changes in
> advance of pushing the red button.

I think that instead of forcing the user to append a CASCADE keyword at
the end of the command, it could perhaps return a bunch of commands to
alter all views.  The user would inspect those commands and fix those
that need fixing, then rerun the whole bunch.  I would imagine a UI
similar to "git rebase", which first gives you a list of things to do,
which you can edit, and upon save-exit the final list of commands is
executed.  Any error during the execution abort the entire transaction,
so if the user makes mistakes the thing is started afresh.

If you have a complex maze of views, I think this (or something similar
that gives enough leeway to the user) is the only way to enable a
nontrivial alteration of one of the tables or views at the bottom.
There is no way that we're going to allow automatic schema changes
otherwise.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Maxence Ahlouche
Date:
Subject: Re: [GSoC] Clustering in MADlib - status update
Next
From: Robert Haas
Date:
Subject: Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?