0001-pg_stat_get_replication_slot-NULL-handling_PG14.patch
text/x-patch
Filename: 0001-pg_stat_get_replication_slot-NULL-handling_PG14.patch
Type: text/x-patch
Part: 1
Patch
Format: format-patch
Series: patch 0001
Subject: pg_stat_get_replication_slot NULL handling.
| File | + | − |
|---|---|---|
| src/include/catalog/pg_proc.dat | 1 | 1 |
| src/test/regress/expected/misc_functions.out | 8 | 0 |
| src/test/regress/sql/misc_functions.sql | 5 | 0 |
From a5ff5cadf5bb386bc3b32b7c8340718ce44fdc74 Mon Sep 17 00:00:00 2001
From: Vigneshwaran C <vignesh21@gmail.com>
Date: Sun, 27 Mar 2022 11:47:05 +0530
Subject: [PATCH] pg_stat_get_replication_slot NULL handling.
Passing NULL to pg_stat_get_replication_slot crashes. Set isstrict to true for
pg_stat_get_replication_slot function to handle it.
---
src/include/catalog/pg_proc.dat | 2 +-
src/test/regress/expected/misc_functions.out | 8 ++++++++
src/test/regress/sql/misc_functions.sql | 5 +++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 79669bf5a2..4a1f0fe0ef 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5310,7 +5310,7 @@
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}',
prosrc => 'pg_stat_get_wal_receiver' },
{ oid => '6169', descr => 'statistics: information about replication slot',
- proname => 'pg_stat_get_replication_slot', prorows => '1', proisstrict => 'f',
+ proname => 'pg_stat_get_replication_slot', prorows => '1', proisstrict => 't',
proretset => 't', provolatile => 's', proparallel => 'r',
prorettype => 'record', proargtypes => 'text',
proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}',
diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out
index e845042d38..3883aebdfe 100644
--- a/src/test/regress/expected/misc_functions.out
+++ b/src/test/regress/expected/misc_functions.out
@@ -214,6 +214,14 @@ select count(*) > 0 from
t
(1 row)
+--
+-- Test NULL handling of pg_stat_get_replication_slot
+--
+SELECT pg_stat_get_replication_slot(NULL);
+ pg_stat_get_replication_slot
+------------------------------
+(0 rows)
+
--
-- Test adding a support function to a subject function
--
diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql
index a398349afc..5029f5d931 100644
--- a/src/test/regress/sql/misc_functions.sql
+++ b/src/test/regress/sql/misc_functions.sql
@@ -69,6 +69,11 @@ select count(*) > 0 from
where spcname = 'pg_default') pts
join pg_database db on pts.pts = db.oid;
+--
+-- Test NULL handling of pg_stat_get_replication_slot
+--
+SELECT pg_stat_get_replication_slot(NULL);
+
--
-- Test adding a support function to a subject function
--
--
2.32.0