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

From: Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is there a way to detect that code is inside CREATE EXTENSION?
Date: 2022-12-13 18:59:07
Message-ID: CACxu=v+pNTdh7FvnXjAwwj90HNJsfkgLnFkuUhBxxF7F_rqbZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> At the C-code level you can check the creating_extension global variable,
> or maybe better look at the in_extension fields of CollectedCommands.
>

Thanks Tom!

That was the hint I needed, looks like pg_event_trigger_ddl_commands() has
an in_extension boolean that seems like it will do what I need? If I
understand you correctly that's what you're referring to with
CollectedCommands. Testing it now but that looks like the answer for me,
if any of those are true then I can just skip the regeneration.

-Michel

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shaozhong SHI 2022-12-13 21:20:04 Re: print in plpython not appearing in logs
Previous Message Julien Rouhaud 2022-12-13 18:58:33 Re: Is there a way to detect that code is inside CREATE EXTENSION?