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-05-28T12:22:13Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > > Well, pg_dump is trying to do something different than what you're > trying to do here. pg_dump wants to make sure that the view, when fed > back into psql, creates the same view that exists now, regardless of > whether that's what the user created originally. For example, if a > view is created referring to table foo, and table foo is later renamed > to bar, then pg_dump wants to (and does) dump a statement referring to > bar, not foo - even if there's a *new* table called foo against which > the view could have been defined. Similarly, pg_dump will > schema-qualify functions and operators, or not, based on whether > that's necessary to reference the exact same operators that were > selected when the original CREATE VIEW command was run, regardless of > whether the original references were schema-qualified. Sorry, I don't see how any of the above is a problem in my use case. Should a table has been renamed, naturally we want to re-create the view referring to the *old* table, but under its *new name*. The same goes with schema-qualifying objects. > 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. -- Alex
Commits
-
Allow CREATE OR REPLACE VIEW to add columns to the _end_ of the view.
- ff1ea2173a92 8.4.0 cited