Skip to content

Commit 43a7dc9

Browse files
committed
Fix NULL input behaviour of pg_stat_get_replication_slot().
pg_stat_get_replication_slot() accidentally was marked as non-strict, crashing when called with NULL input. As it's already released, introduce an explicit NULL check in 14, fix the catalog in HEAD. Bumps catversion in HEAD. Discussion: https://postgr.es/m/20220326212432.s5n2maw6kugnpyxw@alap3.anarazel.de Backpatch: 14-, where replication slot stats were introduced
1 parent 8af3642 commit 43a7dc9

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 202203241
56+
#define CATALOG_VERSION_NO 202203271
5757

5858
#endif

src/include/catalog/pg_proc.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -5370,7 +5370,7 @@
53705370
proargnames => '{pid,status,receive_start_lsn,receive_start_tli,written_lsn,flushed_lsn,received_tli,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time,slot_name,sender_host,sender_port,conninfo}',
53715371
prosrc => 'pg_stat_get_wal_receiver' },
53725372
{ oid => '6169', descr => 'statistics: information about replication slot',
5373-
proname => 'pg_stat_get_replication_slot', proisstrict => 'f', provolatile => 's',
5373+
proname => 'pg_stat_get_replication_slot', provolatile => 's',
53745374
proparallel => 'r', prorettype => 'record', proargtypes => 'text',
53755375
proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}',
53765376
proargmodes => '{i,o,o,o,o,o,o,o,o,o,o}',

src/test/regress/expected/stats.out

+7
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,11 @@ SELECT pg_stat_get_tuples_hot_updated('brin_hot'::regclass::oid);
255255

256256
DROP TABLE brin_hot;
257257
DROP FUNCTION wait_for_hot_stats();
258+
-- ensure that stats accessors handle NULL input correctly
259+
SELECT pg_stat_get_replication_slot(NULL);
260+
pg_stat_get_replication_slot
261+
------------------------------
262+
263+
(1 row)
264+
258265
-- End of Stats Test

src/test/regress/sql/stats.sql

+4
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,8 @@ DROP TABLE brin_hot;
229229
DROP FUNCTION wait_for_hot_stats();
230230

231231

232+
-- ensure that stats accessors handle NULL input correctly
233+
SELECT pg_stat_get_replication_slot(NULL);
234+
235+
232236
-- End of Stats Test

0 commit comments

Comments
 (0)