public inbox for [email protected]  
help / color / mirror / Atom feed
From: Florents Tselai <[email protected]>
To: Yurii Rashkovskii <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: SQL function to access to `creating_extension`
Date: Sat, 19 Apr 2025 12:52:40 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAG=VW17kAweKGwqtVU8vn71uRCOS9yxnyEnoa=-3sAuyZt5O6g@mail.gmail.com>
References: <CAG=VW17kAweKGwqtVU8vn71uRCOS9yxnyEnoa=-3sAuyZt5O6g@mail.gmail.com>



> On 19 Apr 2025, at 4:18 AM, Yurii Rashkovskii <[email protected]> wrote:
> 
> Hi,
> 
> I propose to introduce `pg_creating_extension()` function that would return the OID of the extension being currently created (or `null` if none is).
> 
> The core motivation for it is to be able to establish data provenance in tables created by extensions to be used in `pg_extension_config_dump` configuration. This way, even if a secondary extension inserts data, it can still be excluded from the dump by tracking data provenance in a column with a default. Something like
> 
> ```
> create table my_config (
>    --- ...
>    extension_provenance oid default pg_creating_extension()
> )
> ```
> 
> This would allow for a generalized exclusion in pg_extension_config_dump.
> 
> I've attached a draft patch for this simple function. I am happy to finalize it with tests and documentation if there is a consensus on the shape.
> 
> --
> Founder at Omnigres
> https://omnigres.com <https://omnigres.com/><v1-0001-pg_creating_extension-to-inspect-if-an-extension-is-.patch;


Hi Yurii,  

+1 from me.  

I can see this being helpful, especially when dealing with shared tables or managing extension-specific data in configuration dumps.



view thread (2+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: SQL function to access to `creating_extension`
  In-Reply-To: <[email protected]>

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

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