SQL function to access to `creating_extension`

From: Yurii Rashkovskii <yrashk(at)omnigres(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: SQL function to access to `creating_extension`
Date: 2025-04-19 01:18:21
Message-ID: CAG=VW17kAweKGwqtVU8vn71uRCOS9yxnyEnoa=-3sAuyZt5O6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-pg_creating_extension-to-inspect-if-an-extension-is-.patch application/octet-stream 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2025-04-19 08:00:00 Re: Typos in the code and README
Previous Message Tom Lane 2025-04-18 23:26:32 Re: disabled SSL log_like tests