public inbox for [email protected]  
help / color / mirror / Atom feed
DROP EXTENSION
13+ messages / 7 participants
[nested] [flat]

* DROP EXTENSION
@ 2016-06-20 16:00  [email protected]
  0 siblings, 1 reply; 13+ messages in thread

From: [email protected] @ 2016-06-20 16:00 UTC (permalink / raw)
  To: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.5/static/sql-dropextension.html
Description:

I dropped an extension in my database with a function dependency.  The
function was dropped (without messages of dependencies) and leaving the
function intact.
The lines "DROP EXTENSION removes extensions from the database. Dropping an
extension causes its component objects to be dropped as well." is not clear.
 It should be stated that by default the dependencies remain intact after
the drop.
However, I think this is an error in the command.  It should be the default
behavior to produce an error message stating there are dependencies and the
extension cannot be dropped.

-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 00:21  Michael Paquier <[email protected]>
  parent: [email protected]
  0 siblings, 1 reply; 13+ messages in thread

From: Michael Paquier @ 2016-06-21 00:21 UTC (permalink / raw)
  To: [email protected]; +Cc: pgsql-docs

On Tue, Jun 21, 2016 at 1:00 AM,  <[email protected]> wrote:
> Page: https://www.postgresql.org/docs/9.5/static/sql-dropextension.html
> Description:
> I dropped an extension in my database with a function dependency.  The
> function was dropped (without messages of dependencies) and leaving the
> function intact.
> The lines &quot;DROP EXTENSION removes extensions from the database. Dropping an
> extension causes its component objects to be dropped as well.&quot; is not clear.
>  It should be stated that by default the dependencies remain intact after
> the drop.

I am not following here. If an extension is dropped, so are its
dependencies. See that for example:
=# create extension pg_trgm;
CREATE EXTENSION
Time: 27.978 ms
=# \dx+ pg_trgm
                                  Objects in extension "pg_trgm"
                                        Object Description
--------------------------------------------------------------------------------------------------
 function gin_extract_query_trgm(text,internal,smallint,internal,internal,internal,internal)
 function gin_extract_value_trgm(text,internal)
[... lots of objects, including functions ...]
=# DROP EXTENSION pg_trgm;
DROP EXTENSION
=# \df gin_extract_query_trgm
                       List of functions
 Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+---------------------+------
(0 rows)
-- 
Michael


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 16:57  Alvaro Herrera <[email protected]>
  parent: Michael Paquier <[email protected]>
  0 siblings, 1 reply; 13+ messages in thread

From: Alvaro Herrera @ 2016-06-21 16:57 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: [email protected]; pgsql-docs

Michael Paquier wrote:
> On Tue, Jun 21, 2016 at 1:00 AM,  <[email protected]> wrote:
> > Page: https://www.postgresql.org/docs/9.5/static/sql-dropextension.html
> > Description:
> > I dropped an extension in my database with a function dependency.  The
> > function was dropped (without messages of dependencies) and leaving the
> > function intact.
> > The lines &quot;DROP EXTENSION removes extensions from the database. Dropping an
> > extension causes its component objects to be dropped as well.&quot; is not clear.
> >  It should be stated that by default the dependencies remain intact after
> > the drop.
> 
> I am not following here.

I think the use case involves the user creating a function that depends
on something (probably another function) in the extension.  So you drop
the extension, which drops the function your own function depends on,
but your own function remains in place.

This seems very similar to the use case for which we added the ALTER
OBJECT DEPEND ON EXTENSION (cited below) but not quite the same.
Perhaps mschwan can clarify.

commit f2fcad27d59c8e5c48f8fa0a96c8355e40f24273
Author:     Alvaro Herrera <[email protected]>
AuthorDate: Tue Apr 5 18:38:54 2016 -0300
CommitDate: Tue Apr 5 18:38:54 2016 -0300

    Support ALTER THING .. DEPENDS ON EXTENSION
    
    This introduces a new dependency type which marks an object as depending
    on an extension, such that if the extension is dropped, the object
    automatically goes away; and also, if the database is dumped, the object
    is included in the dump output.  Currently the grammar supports this for
    indexes, triggers, materialized views and functions only, although the
    utility code is generic so adding support for more object types is a
    matter of touching the parser rules only.
    
    Author: Abhijit Menon-Sen
    Reviewed-by: Alexander Korotkov, Álvaro Herrera
    Discussion: http://www.postgresql.org/message-id/[email protected]


-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 18:13  Alvaro Herrera <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 1 reply; 13+ messages in thread

From: Alvaro Herrera @ 2016-06-21 18:13 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: [email protected]; pgsql-docs

Alvaro Herrera wrote:
> Michael Paquier wrote:
> > On Tue, Jun 21, 2016 at 1:00 AM,  <[email protected]> wrote:
> > > Page: https://www.postgresql.org/docs/9.5/static/sql-dropextension.html
> > > Description:
> > > I dropped an extension in my database with a function dependency.  The
> > > function was dropped (without messages of dependencies) and leaving the
> > > function intact.
> > > The lines &quot;DROP EXTENSION removes extensions from the database. Dropping an
> > > extension causes its component objects to be dropped as well.&quot; is not clear.
> > >  It should be stated that by default the dependencies remain intact after
> > > the drop.
> > 
> > I am not following here.
> 
> I think the use case involves the user creating a function that depends
> on something (probably another function) in the extension.  So you drop
> the extension, which drops the function your own function depends on,
> but your own function remains in place.

Right; mschwan wrote private email to indicate that the function in
question is:

CREATE OR REPLACE FUNCTION public.f_unaccent(text)
  RETURNS text AS
$$
  select public.unaccent('public.unaccent', $1)
$$
  LANGUAGE sql IMMUTABLE;

so when the unaccent extension is dropped, this function remains (of
course) but it stops working.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 18:26  Tom Lane <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 2 replies; 13+ messages in thread

From: Tom Lane @ 2016-06-21 18:26 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; [email protected]; pgsql-docs

Alvaro Herrera <[email protected]> writes:
> Right; mschwan wrote private email to indicate that the function in
> question is:

> CREATE OR REPLACE FUNCTION public.f_unaccent(text)
>   RETURNS text AS
> $$
>   select public.unaccent('public.unaccent', $1)
> $$
>   LANGUAGE sql IMMUTABLE;

> so when the unaccent extension is dropped, this function remains (of
> course) but it stops working.

Ah, I kind of suspected that: the issue is that we don't analyze function
bodies to detect dependencies therein.  In a perfect world we would, but
there are daunting obstacles in the way.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 18:28  Michelle Schwan <[email protected]>
  parent: Tom Lane <[email protected]>
  1 sibling, 1 reply; 13+ messages in thread

From: Michelle Schwan @ 2016-06-21 18:28 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; pgsql-docs

Ok - I understand!

However, could that be stated in the documentation so that is clear?

-----Original Message-----
From: Tom Lane [mailto:[email protected]] 
Sent: Tuesday, June 21, 2016 2:27 PM
To: Alvaro Herrera
Cc: Michael Paquier; Michelle Schwan; [email protected]
Subject: Re: [DOCS] DROP EXTENSION

Alvaro Herrera <[email protected]> writes:
> Right; mschwan wrote private email to indicate that the function in 
> question is:

> CREATE OR REPLACE FUNCTION public.f_unaccent(text)
>   RETURNS text AS
> $$
>   select public.unaccent('public.unaccent', $1) $$
>   LANGUAGE sql IMMUTABLE;

> so when the unaccent extension is dropped, this function remains (of
> course) but it stops working.

Ah, I kind of suspected that: the issue is that we don't analyze function bodies to detect dependencies therein.  In a perfect world we would, but there are daunting obstacles in the way.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 18:32  Alvaro Herrera <[email protected]>
  parent: Tom Lane <[email protected]>
  1 sibling, 1 reply; 13+ messages in thread

From: Alvaro Herrera @ 2016-06-21 18:32 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Michael Paquier <[email protected]>; [email protected]; pgsql-docs

Tom Lane wrote:
> Alvaro Herrera <[email protected]> writes:
> > Right; mschwan wrote private email to indicate that the function in
> > question is:
> 
> > CREATE OR REPLACE FUNCTION public.f_unaccent(text)
> >   RETURNS text AS
> > $$
> >   select public.unaccent('public.unaccent', $1)
> > $$
> >   LANGUAGE sql IMMUTABLE;
> 
> > so when the unaccent extension is dropped, this function remains (of
> > course) but it stops working.
> 
> Ah, I kind of suspected that: the issue is that we don't analyze function
> bodies to detect dependencies therein.  In a perfect world we would, but
> there are daunting obstacles in the way.

Right :-(

So the ALTER FUNCTION .. DEPENDS ON EXTENSION thingy would kind-of help,
but instead of preventing the drop of the extension (which is probably
what mschwan would like to happen), it would silently drop the
public.f_unaccent() function when the extension was dropped.

I think (untested) that adding a pg_depend row with deptype='n' instead
of 'e' would have the desired property, i.e. DROP EXTENSION says "cannot
drop extension because function depends on it", and DROP EXTENSION
CASCADE drops both extension and function.  Maybe we could add
   ALTER FUNCTION .. DEPENDS ON EXTENSION unaccent WITH (autodrop=false)
or something similar.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-21 22:55  Tom Lane <[email protected]>
  parent: Michelle Schwan <[email protected]>
  0 siblings, 0 replies; 13+ messages in thread

From: Tom Lane @ 2016-06-21 22:55 UTC (permalink / raw)
  To: Michelle Schwan <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

Michelle Schwan <[email protected]> writes:
> Ok - I understand!
> However, could that be stated in the documentation so that is clear?

I had thought it *was* documented, but can't find such a statement at
the moment.  However, the natural place to document it would be in
section 5.13 "Dependency Tracking", and/or in discussions of user-defined
functions; this behavior really has nothing to do with extensions per se.
So I'm not sure it would have helped you :-(

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-22 00:15  Tom Lane <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 1 reply; 13+ messages in thread

From: Tom Lane @ 2016-06-22 00:15 UTC (permalink / raw)
  To: Michelle Schwan <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

Michelle Schwan <[email protected]> writes:
> That sounds good (but in my case there was no "silent drop"!).
> I would presume that standard functionality would be drop cascade drops all dependent and just drop errors if extension is used anywhere.  But, in the meantime, I think the documentation should reflect this feature.

Done at
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=342921078a76a34fd2f44f121f2251267...

Results should be visible at
https://www.postgresql.org/docs/devel/static/ddl-depend.html
in half an hour or so.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-23 01:32  Bruce Momjian <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 13+ messages in thread

From: Bruce Momjian @ 2016-06-23 01:32 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Michelle Schwan <[email protected]>; Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

On Tue, Jun 21, 2016 at 08:15:35PM -0400, Tom Lane wrote:
> Michelle Schwan <[email protected]> writes:
> > That sounds good (but in my case there was no "silent drop"!).
> > I would presume that standard functionality would be drop cascade drops all dependent and just drop errors if extension is used anywhere.  But, in the meantime, I think the documentation should reflect this feature.
> 
> Done at
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=342921078a76a34fd2f44f121f2251267...
> 
> Results should be visible at
> https://www.postgresql.org/docs/devel/static/ddl-depend.html
> in half an hour or so.

Uh, I don't think that builds every 30 minutes --- I think it is 4-6
hours.  Comments?

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+                     Ancient Roman grave inscription +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-23 07:25  Magnus Hagander <[email protected]>
  parent: Bruce Momjian <[email protected]>
  0 siblings, 2 replies; 13+ messages in thread

From: Magnus Hagander @ 2016-06-23 07:25 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Tom Lane <[email protected]>; Michelle Schwan <[email protected]>; Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

On Thu, Jun 23, 2016 at 3:32 AM, Bruce Momjian <[email protected]> wrote:

> On Tue, Jun 21, 2016 at 08:15:35PM -0400, Tom Lane wrote:
> > Michelle Schwan <[email protected]> writes:
> > > That sounds good (but in my case there was no "silent drop"!).
> > > I would presume that standard functionality would be drop cascade
> drops all dependent and just drop errors if extension is used anywhere.
> But, in the meantime, I think the documentation should reflect this feature.
> >
> > Done at
> >
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=342921078a76a34fd2f44f121f2251267...
> >
> > Results should be visible at
> > https://www.postgresql.org/docs/devel/static/ddl-depend.html
> > in half an hour or so.
>
> Uh, I don't think that builds every 30 minutes --- I think it is 4-6
> hours.  Comments?
>

Correct, the developer docs are updated every 4 hours.

But as it's a fairly predictable every-4-hours (unless there is something
broken in the build), the actual remaining time can be estimated by looking
at the buildfarm.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-23 13:28  Bruce Momjian <[email protected]>
  parent: Magnus Hagander <[email protected]>
  1 sibling, 0 replies; 13+ messages in thread

From: Bruce Momjian @ 2016-06-23 13:28 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: Tom Lane <[email protected]>; Michelle Schwan <[email protected]>; Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

On Thu, Jun 23, 2016 at 09:25:26AM +0200, Magnus Hagander wrote:
> 
> 
> On Thu, Jun 23, 2016 at 3:32 AM, Bruce Momjian <[email protected]> wrote:
> 
>     On Tue, Jun 21, 2016 at 08:15:35PM -0400, Tom Lane wrote:
>     > Michelle Schwan <[email protected]> writes:
>     > > That sounds good (but in my case there was no "silent drop"!).
>     > > I would presume that standard functionality would be drop cascade drops
>     all dependent and just drop errors if extension is used anywhere.  But, in
>     the meantime, I think the documentation should reflect this feature.
>     >
>     > Done at
>     > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=
>     342921078a76a34fd2f44f121f225126778eb2cb
>     >
>     > Results should be visible at
>     > https://www.postgresql.org/docs/devel/static/ddl-depend.html
>     > in half an hour or so.
> 
>     Uh, I don't think that builds every 30 minutes --- I think it is 4-6
>     hours.  Comments?
> 
> 
> Correct, the developer docs are updated every 4 hours.
> 
> But as it's a fairly predictable every-4-hours (unless there is something
> broken in the build), the actual remaining time can be estimated by looking at
> the buildfarm.

OK.  I do maintain a doc build that is <20 minutes so I can quickly post
URLs for doc review:

	http://momjian.us/pgsql_docs/

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+                     Ancient Roman grave inscription +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: DROP EXTENSION
@ 2016-06-23 13:46  Tom Lane <[email protected]>
  parent: Magnus Hagander <[email protected]>
  1 sibling, 0 replies; 13+ messages in thread

From: Tom Lane @ 2016-06-23 13:46 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Michelle Schwan <[email protected]>; Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; pgsql-docs

Magnus Hagander <[email protected]> writes:
> On Thu, Jun 23, 2016 at 3:32 AM, Bruce Momjian <[email protected]> wrote:
>> On Tue, Jun 21, 2016 at 08:15:35PM -0400, Tom Lane wrote:
>>> Results should be visible at
>>> https://www.postgresql.org/docs/devel/static/ddl-depend.html
>>> in half an hour or so.

>> Uh, I don't think that builds every 30 minutes --- I think it is 4-6
>> hours.  Comments?

> Correct, the developer docs are updated every 4 hours.
> But as it's a fairly predictable every-4-hours (unless there is something
> broken in the build), the actual remaining time can be estimated by looking
> at the buildfarm.

Yup.  That's what I did.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs




^ permalink  raw  reply  [nested|flat] 13+ messages in thread


end of thread, other threads:[~2016-06-23 13:46 UTC | newest]

Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20 16:00 DROP EXTENSION [email protected]
2016-06-21 00:21 ` Michael Paquier <[email protected]>
2016-06-21 16:57   ` Alvaro Herrera <[email protected]>
2016-06-21 18:13     ` Alvaro Herrera <[email protected]>
2016-06-21 18:26       ` Tom Lane <[email protected]>
2016-06-21 18:28         ` Michelle Schwan <[email protected]>
2016-06-21 22:55           ` Tom Lane <[email protected]>
2016-06-21 18:32         ` Alvaro Herrera <[email protected]>
2016-06-22 00:15           ` Tom Lane <[email protected]>
2016-06-23 01:32             ` Bruce Momjian <[email protected]>
2016-06-23 07:25               ` Magnus Hagander <[email protected]>
2016-06-23 13:28                 ` Bruce Momjian <[email protected]>
2016-06-23 13:46                 ` Tom Lane <[email protected]>

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