Re: System views for versions reporting

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jian he <jian(dot)universality(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: System views for versions reporting
Date: 2025-11-26 13:28:06
Message-ID: d7d0315b35a5f71660b1b40fa1f5c3194d78dad8.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-11-26 13:40:32 Re: [PATCH] psql: add size-based sorting options (O/o) for tables and indexes
Previous Message Mircea Cadariu 2025-11-26 13:25:31 Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication