Is there a way to detect that code is inside CREATE EXTENSION?

From: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Is there a way to detect that code is inside CREATE EXTENSION?
Date: 2022-12-13 18:39:19
Message-ID: CACxu=vL28Rew2P6TP05BdUS3m9J5-7H3rgbsa_GTBd6X+o=GZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm working with an event trigger that fires on ALTER TABLE and regenerates
certain objects, but unfortunately those objects end up being owned by any
extensions that run ALTER TABLE and any subsequent alterations fail to
regenerate because they are owned by that extension.

Ideally, I'd like to be able to detect inside my trigger if I'm being
called from CREATE EXTENSION or not, but I can't find any obvious way to
detect that. I hope this isn't obvious and I just missed something in the
documentation. Does anyone have any pointers or hacks they know of that
can accomplish this?

Thanks,

-Michel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-12-13 18:49:07 Re: Is there a way to detect that code is inside CREATE EXTENSION?
Previous Message vignesh C 2022-12-13 09:17:32 Re: Support logical replication of DDLs