Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)
Date
Msg-id CAEudQAqnXgR8FW0O4_gori=i6WuNfWmaXypaayF4j8yvxesf+g@mail.gmail.com
Whole thread Raw
In response to Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
Em ter., 17 de jun. de 2025 às 10:09, Aleksander Alekseev <aleksander@timescale.com> escreveu:
Hi,

>> We would be in serious trouble if RelationReloadNailed() could be
>> called for a non-existing relation. Wouldn't Assert() be more
>> appropriate?
>
> IMO, I think no.
>
> In all paths, this check is done, why would this be the only exception?

We use Asserts() for cases that shouldn't happen in practice for
performance reasons.
If you are concerned about performance in this case,
you can rest assured.
 
Since this code doesn't crash.
No, you can't be sure.
 
I suspect this is
one of such cases. Unless you are aware of a specific scenario that
makes the code crash of course.
ScanPgRelation really can fail, better make sure.

best regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)
Next
From: Andres Freund
Date:
Subject: Re: Non-reproducible AIO failure