Re: pg_stat_get_replication_slot() marked not strict, crashes

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: pg_stat_get_replication_slot() marked not strict, crashes
Date: 2022-03-28 04:42:47
Message-ID: CAD21AoAGnTjb-HxgKqxm1bS1vO1W+rkJYAMqrviHq4kkBNnyRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 27, 2022 at 6:52 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> On 2022-03-26 17:41:53 -0400, Tom Lane wrote:
> > Andres Freund <andres(at)anarazel(dot)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.

Right. But it seems like we cannot simply add PG_ARGISNULL () to
PG_GETARG_DATUM(). There are some codes such as array_remove() and
array_replace() that call PG_GETARG_DATUM() and PG_ARGISNULL() and
pass these values to functions that do is-null check

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-03-28 04:54:12 Re: pg_stat_get_replication_slot() marked not strict, crashes
Previous Message Michael Paquier 2022-03-28 04:31:16 Re: Preventing indirection for IndexPageGetOpaque for known-size page special areas