On May 5, 2015, at 10:07 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>> So AFAICS we need to actually drop and recreate
>> the citext regexp_matches() functions in the upgrade script. That means
>> "ALTER EXTENSION citext UPDATE" will fail if these functions are being
>> used in any views. That's annoying but I see no way around it. (We
>> could have the upgrade script do DROP CASCADE, but that seems way too
>> destructive.)
>
> I think we do need to have the upgrade script drop/recreate without
> cascade. Then, users can "alter extension upgrade", note the
> problematic views (which should be part of the error message), drop
> them, then retry the extension update and re-create their views. This
> is necessarily a manual procedure -- I don't think we can re-create
> views using the function automatically. CASCADE seems pretty dangerous.
FWIW, this is a challenge inherent in all extension upgrade scripts. It’d be great if there was a way to defer such
dependencyerrors to COMMIT time, so if a function is replaced with a new one that’s compatible with the old, the
dependencytree could be updated automatically.
Best,
David