Re: System views for versions reporting
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, jian he <jian.universality@gmail.com>, Joe
Conway <mail@joeconway.com>, pgsql-hackers@postgresql.org
Date: 2025-11-26T13:28:06Z
Lists: pgsql-hackers
On Tue, 2025-11-25 at 16:40 +0100, Dmitry Dolgov wrote:
> Here is the updated patch.
Thanks for the updated patch.
Comments:
You didn't address any of my suggestions concerning the documentation,
except that you moved the entry in "System Views" to the correct place.
The second patch contains:
> +void
> +jit_register_version(void)
> +{
> + add_system_version("LLVM", jit_get_version, RunTime);
> +}
But that belongs into the third patch.
+/*
+ * Callback for add_system_version, returns JIT provider's version string and
+ * reports if it's not available.
+ */
+const char *
+jit_get_version(bool *available)
+{
+ const char *version;
+
+ if (!provider_init())
+ {
+ *available = false;
+ return "";
+ }
+
+ version = provider.get_version();
+
+ if (version == NULL)
+ {
+ *available = false;
+ return "";
+ }
+
+ *available = true;
+ return version;
+}
Perhaps more elegant would be:
if (provider_init())
{
version = provider.get_version();
if (version)
{
*available = true;
return version;
}
}
*available = false;
return "";
Other than that, it looks fine.
Yours,
Laurenz Albe