Re: pg_stat_get_replication_slot() marked not strict, crashes

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org, Amit Kapila <amit.kapila16@gmail.com>
Date: 2022-03-26T21:52:23Z
Lists: pgsql-hackers
Hi,

On 2022-03-26 17:41:53 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I wonder if we ought to make PG_GETARG_DATUM(n) assert that !PG_ARGISNULL(n)?
> > That'd perhaps make it easier to catch some of these...
> 
> Don't see the point; such cases will crash just fine without any
> assert.  The problem is lack of test coverage ...

Not reliably. Byval types typically won't crash, just do something
bogus. As e.g. in the case of pg_stat_get_subscription_stats(NULL) I found to
also be wrong upthread.

Greetings,

Andres Freund



Commits

  1. Mark pg_stat_get_subscription_stats() strict.

  2. Fix NULL input behaviour of pg_stat_get_replication_slot().