Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)
Date: 2025-06-17 13:09:00
Message-ID: CAJ7c6TMpdhueA6RXr1PVhpqGF6YXBLe4M2hL97RFq88Osnza5g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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. Since this code doesn't crash I suspect this is
one of such cases. Unless you are aware of a specific scenario that
makes the code crash of course.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2025-06-17 13:31:13 Re: Avoid possible dereference null pointer (src/backend/utils/cache/relcache.c)
Previous Message Aleksander Alekseev 2025-06-17 13:04:09 Re: --enable-{debug,cassert} should also activate --enable-depend