public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Postgres hackers <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: Masahiko Sawada <[email protected]>
Subject: pg_stat_get_replication_slot and pg_stat_get_subscription_worker incorrectly marked as proretset
Date: Mon, 21 Feb 2022 14:36:33 +0900
Message-ID: <[email protected]> (raw)

Hi all,
(Author and committer added in CC.)

While reviewing the code of a bunch of SRF functions in the core code,
I have noticed that the two functions mentioned in $subject are marked
as proretset but both functions don't return a set of tuples, just one
record for the object given in input.  It is also worth noting that
prorows is set to 1.

This looks like a copy-pasto error that has spread around.  The error
on pg_stat_get_subscription_worker is recent as of 8d74fc9, and the
one on pg_stat_get_replication_slot has been introduced in 3fa17d3,
meaning that REL_14_STABLE got it wrong for the second part.

I am aware about the discussions on the parent view for the first
case and its design issues, but it does not change the fact that we'd
better address the second case on HEAD IMO.

Thoughts?
--
Michael


Attachments:

  [text/x-diff] proc-proretset.patch (1.7K, ../[email protected]/2-proc-proretset.patch)
  download | inline diff:
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 7f1ee97f55..aa05b9665f 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5370,16 +5370,16 @@
   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',
-  proretset => 't', provolatile => 's', proparallel => 'r',
+  proname => 'pg_stat_get_replication_slot', proisstrict => 'f',
+  provolatile => 's', proparallel => 'r',
   prorettype => 'record', proargtypes => 'text',
   proallargtypes => '{text,text,int8,int8,int8,int8,int8,int8,int8,int8,timestamptz}',
   proargmodes => '{i,o,o,o,o,o,o,o,o,o,o}',
   proargnames => '{slot_name,slot_name,spill_txns,spill_count,spill_bytes,stream_txns,stream_count,stream_bytes,total_txns,total_bytes,stats_reset}',
   prosrc => 'pg_stat_get_replication_slot' },
 { oid => '8523', descr => 'statistics: information about subscription worker',
-  proname => 'pg_stat_get_subscription_worker', prorows => '1', proisstrict => 'f',
-  proretset => 't', provolatile => 's', proparallel => 'r',
+  proname => 'pg_stat_get_subscription_worker', proisstrict => 'f',
+  provolatile => 's', proparallel => 'r',
   prorettype => 'record', proargtypes => 'oid oid',
   proallargtypes => '{oid,oid,oid,oid,oid,text,xid,int8,text,timestamptz}',
   proargmodes => '{i,i,o,o,o,o,o,o,o,o}',


  [application/pgp-signature] signature.asc (833B, ../[email protected]/3-signature.asc)
  download

view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pg_stat_get_replication_slot and pg_stat_get_subscription_worker incorrectly marked as proretset
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox