Catalog version access

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Catalog version access
Date: 2021-02-21 23:15:20
Message-ID: 5c6a71f7-1a40-1049-929c-996438b2b5d9@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

I do some very regular testing on HEAD and my scripts need to know if
the catalog version has changed to determine if it needs to pg_restore
or if a basebackup is okay. In order to get it, I have to do this:

# Get the catalog version (there is no better way to do this)
tmp=$(mktemp --directory)
$bin/initdb --pgdata=$tmp
catversion=$($bin/pg_controldata $tmp | grep "Catalog version" \
| cut --delimiter=: --fields=2 | xargs)
rm --recursive --force $tmp

I find this less than attractive, especially since the catalog version
is a property of the binaries and not the data directory. Attached is a
patchset so that the above can become simply:

catversion=$($bin/pg_config --catversion)

and a second patch that adds a read-only guc to get at it on the SQL
level using SHOW catalog_version; or similar. I need that because I
also do a dump of pg_settings and I would like for it to appear there.

Please consider.
--
Vik Fearing

Attachment Content-Type Size
0001-Add-catalog-version-to-pg_config.patch text/x-patch 2.9 KB
0002-Add-catalog_version-guc-accessible-from-SQL.patch text/x-patch 3.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-02-21 23:19:41 Re: Finding cause of test fails on the cfbot site
Previous Message David Fetter 2021-02-21 23:15:03 Re: Extensions not dumped when --schema is used