Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Alex Shulgin <ash@commandprompt.com>
From: ash <ash@commandprompt.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>,
"pgsql-hackers\@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2014-06-02T12:52:06Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Wed, May 28, 2014 at 8:22 AM, ash <ash@commandprompt.com> wrote: >>> None of that involves answering hypothetical questions; but what you >>> want to do does, and that I think is the problem in a nutshell. >> >> In a nutshell I'd like PostgreSQL to just re-parse the *current* view >> definition. Should that throw an error, user intervention will be >> required anyway, but most of the time it should just work. > > What exactly do you mean by "re-parse the current view definition"? I mean do what the user will have to do in this situation anyway: BEGIN; DROP VIEW ...; ALTER TABLE ...; CREATE VIEW ...; COMMIT; Should this fail, the user will have to work around it, but most of the time it could just work. > The only form of the view definition we actually have is already > parsed into an internal form (see pg_rewrite) which, for the reasons > I've attempted to explain, is not easy to adapt to new column types. > I suppose we could deparse that definition and then reparse the > results, but that could lead to some very surprising consequences > (some of which are security-relevant). Like? -- Alex
Commits
-
Allow CREATE OR REPLACE VIEW to add columns to the _end_ of the view.
- ff1ea2173a92 8.4.0 cited