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

From: David Fetter <david(at)fetter(dot)org>
To: ash <ash(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Date: 2014-05-27 04:15:18
Message-ID: 20140527041518.GB28757@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 27, 2014 at 12:37:32AM +0400, ash wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > On Mon, May 26, 2014 at 06:25:09PM +0400, ash wrote:
> >> Hi Hackers,
> >>
> >> This came up recently on general list (and I've just hit the same
> >> issue today):
> >> http://www.postgresql.org/message-id/CAB7nPqTLmMn1LTb5WE0v0dO57iP0U73yKwzbZytAXDF1CAWLZg@mail.gmail.com
> >>
> >> Why couldn't postgres re-create the dependent views
> >> automatically? I mean it knows which views depend on the altered
> >> column and keeps the view definition, no?
> >
> > Also worth considering: functions which take any part of the view
> > as a parameter.
>
> Sorry, I don't get it: do you suggest we should re-create dependent
> functions too?

I'd throw an error in cases where such functions had an obvious and
deterministic dependency on the views, ideally having gone through all
such functions first and enumerated them in the error message.

> I don't think that's feasible, but there is certainly a use case for
> silently re-defining the views together with alteration of the joined
> table.

Indeed.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-05-27 04:30:37 Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD
Previous Message David E. Wheeler 2014-05-27 04:13:46 Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD