pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedDetecting functions installed by an extension
3+ messages / 2 participants
[nested] [flat]
* Detecting functions installed by an extension
@ 2018-06-17 08:05 Benjie Gillam <benjie@jemjie.com>
2018-06-17 08:26 ` Re: Detecting functions installed by an extension Vik Fearing <vik.fearing@2ndquadrant.com>
0 siblings, 1 reply; 3+ messages in thread
From: Benjie Gillam @ 2018-06-17 08:05 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Greetings!
How can I tell, using the system catalog or information schema, if a
function/procedure was created by an extension as opposed to by the user
(i.e. would be dropped if you performed "DROP EXTENSION")? So far I've
looked at the `pg_extension` table, which lists the class IDs of
configuration tables but doesn't mention procedures. I've looked at
`pg_proc` but that doesn't seem to contain the information. I've also
scanned over various other system catalogues but with no luck. Is this
information available in one of the system catalogs? Does PostgreSQL itself
track this information so that it can perform cleanup, or does it expect
the extension to clean up after itself?
Thank you for your time,
Benjie.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Detecting functions installed by an extension
2018-06-17 08:05 Detecting functions installed by an extension Benjie Gillam <benjie@jemjie.com>
@ 2018-06-17 08:26 ` Vik Fearing <vik.fearing@2ndquadrant.com>
2018-06-17 09:09 ` Re: Detecting functions installed by an extension Benjie Gillam <benjie@jemjie.com>
0 siblings, 1 reply; 3+ messages in thread
From: Vik Fearing @ 2018-06-17 08:26 UTC (permalink / raw)
To: Benjie Gillam <benjie@jemjie.com>; pgsql-general@lists.postgresql.org
On 17/06/18 10:05, Benjie Gillam wrote:
> Greetings!
>
> How can I tell, using the system catalog or information schema, if a
> function/procedure was created by an extension as opposed to by the user
> (i.e. would be dropped if you performed "DROP EXTENSION")? So far I've
> looked at the `pg_extension` table, which lists the class IDs of
> configuration tables but doesn't mention procedures. I've looked at
> `pg_proc` but that doesn't seem to contain the information. I've also
> scanned over various other system catalogues but with no luck. Is this
> information available in one of the system catalogs? Does PostgreSQL
> itself track this information so that it can perform cleanup, or does it
> expect the extension to clean up after itself?
All dependencies are tracked in the system catalog pg_depend.
If you do \set ECHO_HIDDEN on in psql and then \dx+ an_extension you
can see what queries psql uses to get the information. That should put
you well on your way to doing what you want.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Detecting functions installed by an extension
2018-06-17 08:05 Detecting functions installed by an extension Benjie Gillam <benjie@jemjie.com>
2018-06-17 08:26 ` Re: Detecting functions installed by an extension Vik Fearing <vik.fearing@2ndquadrant.com>
@ 2018-06-17 09:09 ` Benjie Gillam <benjie@jemjie.com>
0 siblings, 0 replies; 3+ messages in thread
From: Benjie Gillam @ 2018-06-17 09:09 UTC (permalink / raw)
To: Vik Fearing <vik.fearing@2ndquadrant.com>; +Cc: pgsql-general@lists.postgresql.org
On 17 June 2018 at 10:26, Vik Fearing <vik.fearing@2ndquadrant.com> wrote:
> On 17/06/18 10:05, Benjie Gillam wrote:
> > Greetings!
> >
> > How can I tell, using the system catalog or information schema, if a
> > function/procedure was created by an extension as opposed to by the user
> > (i.e. would be dropped if you performed "DROP EXTENSION")? So far I've
> > looked at the `pg_extension` table, which lists the class IDs of
> > configuration tables but doesn't mention procedures. I've looked at
> > `pg_proc` but that doesn't seem to contain the information. I've also
> > scanned over various other system catalogues but with no luck. Is this
> > information available in one of the system catalogs? Does PostgreSQL
> > itself track this information so that it can perform cleanup, or does it
> > expect the extension to clean up after itself?
>
> All dependencies are tracked in the system catalog pg_depend.
>
> If you do \set ECHO_HIDDEN on in psql and then \dx+ an_extension you
> can see what queries psql uses to get the information. That should put
> you well on your way to doing what you want.
> --
> Vik Fearing +33 6 46 75 15 36
> http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
>
It seems so obvious in retrospect! This works beautifully - thanks 🙏
Benjie.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-06-17 09:09 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-17 08:05 Detecting functions installed by an extension Benjie Gillam <benjie@jemjie.com>
2018-06-17 08:26 ` Vik Fearing <vik.fearing@2ndquadrant.com>
2018-06-17 09:09 ` Benjie Gillam <benjie@jemjie.com>
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