Re: alter function/procedure depends on extension

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bryn Llewellyn <bryn(at)yugabyte(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: alter function/procedure depends on extension
Date: 2022-02-18 04:32:20
Message-ID: CAKFQuwY6bR_fZ1DX47E2Q1j38oFw5jaA5GXxxNFn8Q-okAMjqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 17, 2022 at 8:54 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Thu, Feb 17, 2022 at 6:17 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> There is no bug here; it's operating as designed and documented.
> >> Maybe the docs need some refinement.
>
> > We should just say that ALTER FUNCTION ALTER DEPENDS ON makes the target
> > function/procedure a (transient?) member of the extension and it will be
> > dropped when the extension be dropped.
>
> It's not a member though; there's a different syntax for that
> (ALTER EXTENSION name ADD member_object). The differences are
> a bit subtle, but for example making the function an extension
> member would change how pg_dump treats it.
>

So I amend my suggestions to:

https://www.postgresql.org/docs/current/sql-alterfunction.html

"Refuse to drop the extension if any objects depend on it (other than its
own member objects and other extensions listed in the same DROP command).
This is the default."

...(other than its own member objects, other extensions listed in the same
DROP command, and functions and procedures that have been altered to
explicitly depend on those extensions). This is the default.

https://www.postgresql.org/docs/current/sql-alterfunction.html

"This form marks the function as dependent on the extension, or no longer
dependent on that extension if NO is specified. A function that's marked as
dependent on an extension is automatically dropped when the extension is
dropped."

...A function that's marked as dependent on an extension is ignored during
the dependency crawl of a DROP EXTENSION RESTRICT (xref). It can have
multiple extensions it depends on and will be dropped when any one of those
extensions is dropped.

https://www.postgresql.org/docs/current/sql-alterprocedure.html

"The name of the extension that the procedure is to depend on."

Should probably match the sql-alterfunction/html wording substituting in
procedure for function.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2022-02-18 04:37:43 Re: Question on Open PostgreSQL Monitoring
Previous Message Tom Lane 2022-02-18 03:54:07 Re: alter function/procedure depends on extension