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

From: ash <ash(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: 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-05-28 12:22:13
Message-ID: 87bnuihz4a.fsf@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ash 2014-05-28 12:51:48 Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Previous Message Stephen Frost 2014-05-28 12:04:34 Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?