Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, ash <ash(at)commandprompt(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Date: 2014-06-02 18:10:29
Message-ID: 20140602181029.GE5146@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-06-02 18:14:17 Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Previous Message Maxence Ahlouche 2014-06-02 18:09:18 Re: [GSoC] Clustering in MADlib - status update