Re: System views for versions reporting - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: System views for versions reporting
Date
Msg-id d7d0315b35a5f71660b1b40fa1f5c3194d78dad8.camel@cybertec.at
Whole thread Raw
In response to Re: System views for versions reporting  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: System views for versions reporting
List 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



pgsql-hackers by date:

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