From cca186348929cd75f23ef1b25922386bf38cf99c Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 20 Dec 2022 13:36:27 +0900 Subject: Add pg_dissect_walfile_name() This function takes in input a WAL segment name and returns a tuple made of the segment sequence number (dependent on the WAL segment size of the cluster) and its timeline, as of a thin SQL wrapper around the existing XLogFromFileName(). This function has multiple usages, like being able to compile a LSN from a file name and an offset, or finding the timeline of a segment without having to do to some maths based on the first eight characters of the segment. Bump catalog version. Author: Bharath Rupireddy Reviewed-by: Nathan Bossart, Kyotaro Horiguchi, Maxim Orlov, Michael Paquier Discussion: https://postgr.es/m/CALj2ACWV=FCddsxcGbVOA=cvPyMr75YCFbSQT6g4KDj=gcJK4g@mail.gmail.com --- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 094f59f82db..091ad94c5eb 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202212191 +#define CATALOG_VERSION_NO 202212201 #endif diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index d763419c0de..98d90d93389 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -6372,6 +6372,13 @@ { oid => '2851', descr => 'wal filename, given a wal location', proname => 'pg_walfile_name', prorettype => 'text', proargtypes => 'pg_lsn', prosrc => 'pg_walfile_name' }, +{ oid => '8205', + descr => 'sequence number and timeline ID given a wal filename', + proname => 'pg_dissect_walfile_name', provolatile => 's', + prorettype => 'record', proargtypes => 'text', + proallargtypes => '{text,numeric,int8}', proargmodes => '{i,o,o}', + proargnames => '{file_name,segno,timeline_id}', + prosrc => 'pg_dissect_walfile_name' }, { oid => '3165', descr => 'difference in bytes, given two wal locations', proname => 'pg_wal_lsn_diff', prorettype => 'numeric', -- cgit v1.2.3