pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Bryn Llewellyn <bryn@yugabyte.com>
To: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: alter function/procedure depends on extension
Date: Thu, 17 Feb 2022 09:04:45 -0800
Message-ID: <4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com> (raw)
In-Reply-To: <7C2D01B4-AD32-48DB-B5FA-6FFBC312ECB2@yugabyte.com>
References: <7C2D01B4-AD32-48DB-B5FA-6FFBC312ECB2@yugabyte.com>

On 2/17/22 08:52, Bryn Llewellyn wrote:
> **Briefly**
> 

> *qu. 2.* Why does "drop extension restrict" quietly succeed—having the 
> effect of cascade-dropping any subprogram that you've altered to depend 
> on the extension in question? This is at odds with the documented 
> meaning of "restrict".

But not the ALTER FUNCTION docs:

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

"DEPENDS ON EXTENSION extension_name
NO DEPENDS ON EXTENSION extension_name

     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.
"

And from DROP EXTENSION

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

"RESTRICT

     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.
"

The DEPENDS ON EXTENSION turns a function into a member object. The 
'...any objects depend on it....' is shown in the EXAMPLES:

"To remove the extension hstore from the current database:

DROP EXTENSION hstore;

This command will fail if any of hstore's objects are in use in the 
database, for example if any tables have columns of the hstore type. Add 
the CASCADE option to forcibly remove those dependent objects as well.
"

> 
> *qu. 3.* I established by experiment that you can repeat "alter 

> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (18+ messages)  latest in thread

Message-ID: <4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com>
Permalink:  ../4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com/
Also on:    postgresql.org/message-id/4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, bryn@yugabyte.com
  Subject: Re: alter function/procedure depends on extension
  In-Reply-To: <4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com>
  References: <7C2D01B4-AD32-48DB-B5FA-6FFBC312ECB2@yugabyte.com> <4c6b69e2-52c6-359d-3ed9-04842f631ffe@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox