Avoid overwiriting cache entry (src/backend/utils/cache/relcache.c)

Ranier Vilela <ranier.vf@gmail.com>

From: Ranier Vilela <ranier.vf@gmail.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-26T14:17:33Z
Lists: pgsql-hackers

Attachments

Hi.

In function *CheckNNConstraintFetch* the array index is
incremented only when "null combin" is not found.

IMO the last cache entry can be overwriting if the next tuple is null,
because, the fill array fields is not syncronized with array index
increment.

Fix by moving the array fill.

patch attached.

best regards,
Ranier Vilela

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. CheckNNConstraintFetch: Fill all of ConstrCheck in a single pass

  2. Don't error out when dropping constraint if relchecks is already zero