Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13e0d7a

Browse filesBrowse files
committed
Rename pg_dissect_walfile_name() to pg_split_walfile_name()
The former name was discussed as being confusing, so use "split", as per a suggestion from Magnus Hagander. While on it, one of the output arguments is renamed from "segno" to "segment_number", as per a suggestion from Kyotaro Horiguchi. The documentation is updated to reflect all these changes. Bump catalog version. Author: Bharath Rupireddy, Michael Paquier Discussion: https://postgr.es/m/CABUevEytQVaOOhGdoh0D7hGwe3fuKcRF6NthsSW7ww04EmtFgQ@mail.gmail.com
1 parent ed1a88d commit 13e0d7a
Copy full SHA for 13e0d7a

File tree

6 files changed

+41
-41
lines changed
Filter options

6 files changed

+41
-41
lines changed

‎doc/src/sgml/func.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/func.sgml
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26101,15 +26101,15 @@ LOG: Grand total: 1651920 bytes in 201 blocks; 622360 free (88 chunks); 1029560
2610126101
<row>
2610226102
<entry role="func_table_entry"><para role="func_signature">
2610326103
<indexterm>
26104-
<primary>pg_dissect_walfile_name</primary>
26104+
<primary>pg_split_walfile_name</primary>
2610526105
</indexterm>
26106-
<function>pg_dissect_walfile_name</function> ( <parameter>file_name</parameter> <type>text</type> )
26106+
<function>pg_split_walfile_name</function> ( <parameter>file_name</parameter> <type>text</type> )
2610726107
<returnvalue>record</returnvalue>
26108-
( <parameter>segno</parameter> <type>numeric</type>,
26108+
( <parameter>segment_number</parameter> <type>numeric</type>,
2610926109
<parameter>timeline_id</parameter> <type>bigint</type> )
2611026110
</para>
2611126111
<para>
26112-
Extracts the file sequence number and timeline ID from a WAL file
26112+
Extracts the sequence number and timeline ID from a WAL file
2611326113
name.
2611426114
</para></entry>
2611526115
</row>
@@ -26172,13 +26172,13 @@ postgres=# SELECT * FROM pg_walfile_name_offset((pg_backup_stop()).lsn);
2617226172
</para>
2617326173

2617426174
<para>
26175-
<function>pg_dissect_walfile_name</function> is useful to compute a
26175+
<function>pg_split_walfile_name</function> is useful to compute a
2617626176
<acronym>LSN</acronym> from a file offset and WAL file name, for example:
2617726177
<programlisting>
2617826178
postgres=# \set file_name '000000010000000100C000AB'
2617926179
postgres=# \set offset 256
26180-
postgres=# SELECT '0/0'::pg_lsn + pd.segno * ps.setting::int + :offset AS lsn
26181-
FROM pg_dissect_walfile_name(:'file_name') pd,
26180+
postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset AS lsn
26181+
FROM pg_split_walfile_name(:'file_name') pd,
2618226182
pg_show_all_settings() ps
2618326183
WHERE ps.name = 'wal_segment_size';
2618426184
lsn

‎src/backend/access/transam/xlogfuncs.c

Copy file name to clipboardExpand all lines: src/backend/access/transam/xlogfuncs.c
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,16 @@ pg_walfile_name(PG_FUNCTION_ARGS)
437437
* name.
438438
*/
439439
Datum
440-
pg_dissect_walfile_name(PG_FUNCTION_ARGS)
440+
pg_split_walfile_name(PG_FUNCTION_ARGS)
441441
{
442-
#define PG_DISSECT_WALFILE_NAME_COLS 2
442+
#define PG_SPLIT_WALFILE_NAME_COLS 2
443443
char *fname = text_to_cstring(PG_GETARG_TEXT_PP(0));
444444
char *fname_upper;
445445
char *p;
446446
TimeLineID tli;
447447
XLogSegNo segno;
448-
Datum values[PG_DISSECT_WALFILE_NAME_COLS] = {0};
449-
bool isnull[PG_DISSECT_WALFILE_NAME_COLS] = {0};
448+
Datum values[PG_SPLIT_WALFILE_NAME_COLS] = {0};
449+
bool isnull[PG_SPLIT_WALFILE_NAME_COLS] = {0};
450450
TupleDesc tupdesc;
451451
HeapTuple tuple;
452452
char buf[256];
@@ -482,7 +482,7 @@ pg_dissect_walfile_name(PG_FUNCTION_ARGS)
482482

483483
PG_RETURN_DATUM(result);
484484

485-
#undef PG_DISSECT_WALFILE_NAME_COLS
485+
#undef PG_SPLIT_WALFILE_NAME_COLS
486486
}
487487

488488
/*

‎src/include/catalog/catversion.h

Copy file name to clipboardExpand all lines: src/include/catalog/catversion.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202212231
60+
#define CATALOG_VERSION_NO 202212232
6161

6262
#endif

‎src/include/catalog/pg_proc.dat

Copy file name to clipboardExpand all lines: src/include/catalog/pg_proc.dat
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6374,11 +6374,11 @@
63746374
prosrc => 'pg_walfile_name' },
63756375
{ oid => '8205',
63766376
descr => 'sequence number and timeline ID given a wal filename',
6377-
proname => 'pg_dissect_walfile_name', provolatile => 's',
6377+
proname => 'pg_split_walfile_name', provolatile => 's',
63786378
prorettype => 'record', proargtypes => 'text',
63796379
proallargtypes => '{text,numeric,int8}', proargmodes => '{i,o,o}',
6380-
proargnames => '{file_name,segno,timeline_id}',
6381-
prosrc => 'pg_dissect_walfile_name' },
6380+
proargnames => '{file_name,segment_number,timeline_id}',
6381+
prosrc => 'pg_split_walfile_name' },
63826382

63836383
{ oid => '3165', descr => 'difference in bytes, given two wal locations',
63846384
proname => 'pg_wal_lsn_diff', prorettype => 'numeric',

‎src/test/regress/expected/misc_functions.out

Copy file name to clipboardExpand all lines: src/test/regress/expected/misc_functions.out
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -619,26 +619,26 @@ SELECT count(*) > 0 AS ok FROM pg_control_system();
619619
t
620620
(1 row)
621621

622-
-- pg_dissect_walfile_name
623-
SELECT * FROM pg_dissect_walfile_name(NULL);
624-
segno | timeline_id
625-
-------+-------------
626-
|
622+
-- pg_split_walfile_name
623+
SELECT * FROM pg_split_walfile_name(NULL);
624+
segment_number | timeline_id
625+
----------------+-------------
626+
|
627627
(1 row)
628628

629-
SELECT * FROM pg_dissect_walfile_name('invalid');
629+
SELECT * FROM pg_split_walfile_name('invalid');
630630
ERROR: invalid WAL file name "invalid"
631-
SELECT segno > 0 AS ok_segno, timeline_id
632-
FROM pg_dissect_walfile_name('000000010000000100000000');
633-
ok_segno | timeline_id
634-
----------+-------------
635-
t | 1
636-
(1 row)
637-
638-
SELECT segno > 0 AS ok_segno, timeline_id
639-
FROM pg_dissect_walfile_name('ffffffFF00000001000000af');
640-
ok_segno | timeline_id
641-
----------+-------------
642-
t | 4294967295
631+
SELECT segment_number > 0 AS ok_segment_number, timeline_id
632+
FROM pg_split_walfile_name('000000010000000100000000');
633+
ok_segment_number | timeline_id
634+
-------------------+-------------
635+
t | 1
636+
(1 row)
637+
638+
SELECT segment_number > 0 AS ok_segment_number, timeline_id
639+
FROM pg_split_walfile_name('ffffffFF00000001000000af');
640+
ok_segment_number | timeline_id
641+
-------------------+-------------
642+
t | 4294967295
643643
(1 row)
644644

‎src/test/regress/sql/misc_functions.sql

Copy file name to clipboardExpand all lines: src/test/regress/sql/misc_functions.sql
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ SELECT count(*) > 0 AS ok FROM pg_control_init();
230230
SELECT count(*) > 0 AS ok FROM pg_control_recovery();
231231
SELECT count(*) > 0 AS ok FROM pg_control_system();
232232

233-
-- pg_dissect_walfile_name
234-
SELECT * FROM pg_dissect_walfile_name(NULL);
235-
SELECT * FROM pg_dissect_walfile_name('invalid');
236-
SELECT segno > 0 AS ok_segno, timeline_id
237-
FROM pg_dissect_walfile_name('000000010000000100000000');
238-
SELECT segno > 0 AS ok_segno, timeline_id
239-
FROM pg_dissect_walfile_name('ffffffFF00000001000000af');
233+
-- pg_split_walfile_name
234+
SELECT * FROM pg_split_walfile_name(NULL);
235+
SELECT * FROM pg_split_walfile_name('invalid');
236+
SELECT segment_number > 0 AS ok_segment_number, timeline_id
237+
FROM pg_split_walfile_name('000000010000000100000000');
238+
SELECT segment_number > 0 AS ok_segment_number, timeline_id
239+
FROM pg_split_walfile_name('ffffffFF00000001000000af');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.