Add a function to get the version of installed extension

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add a function to get the version of installed extension
Date: 2025-01-21 03:29:37
Message-ID: 20250121122937.edfdba2b3dfa3dba330a6b66@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
When an extension module is updated, first the new binary is installed, then
ALTER EXTENSION UPDATE is executed to create or modify SQL objects. Between
these two steps, users could see an error, or in worst case segfalut, during
a query execution due to the lack or incompatibility of SQL objects.

This might be avoidable if the binary is made carefully to check the existing
of objects, but I think it is useful if an extension module function can check
the current extension version. So, I would like to propose a new function to
return the current extension version, get_extension_version. I've attached a
patch.

Also, as an application of this function, how about allowing to include versions
in the "requires" list in the control file? It seems useful when an extension
requires other extension with a certain version. The proposed
get_extension_version can be used to check the versions of existing extensions.
This is just an idea and a patch is not created yet.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
get_extension_version.patch text/x-diff 1.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2025-01-21 03:31:27 Re: Pre-allocating WAL files
Previous Message Jeff Davis 2025-01-21 03:27:10 Re: Statistics Import and Export