Re: BackendKeyData is mandatory? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: BackendKeyData is mandatory?
Date
Msg-id 2da9038e-bf17-47d1-a5aa-83277c23f3fa@iki.fi
Whole thread Raw
In response to Re: BackendKeyData is mandatory?  (Jelte Fennema-Nio <postgres@jeltef.nl>)
List pgsql-hackers
On 19/08/2025 23:49, Jelte Fennema-Nio wrote:
> On Thu, 14 Aug 2025 at 15:10, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> Here's a new set of patches, to disconnect on OOM instead of hanging or
>> silently discarding messages:
> 
> Code looks good. Som small nitpicks though.
> 
> This change seems unnecessary, i.e. free(NULL) is a no-op
> 
> -        free(svname);
> +        if (svname)
> +            free(svname);

And even more so, this is unreachable when svname == NULL. Thanks!

> Small wording suggestion, maybe change this:
> 
> The caller has already saved the error message in conn->errorMessage.
> 
> to
> 
> The caller should have already saved the error message in conn->errorMessage.
> 
> or even
> 
> The caller should have already saved the error message using
> libpq_append_conn_error.

I kept it as is, because we use similar wording in a few other places. 
Some places do write the message directly in conn->errorMessage without 
using libpq_append_conn_error.

Pushed and backpatched to v18. I feel the OOM handling commit would be 
appropriate to backpatch further, but since it's pretty intricate code 
and we haven't gotten any complaints from the field, I only backpatched 
it to v18 for now. We can backpatch it further later if needed.

Thanks for the original patch and the review!

- Heikki




pgsql-hackers by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: Let plan_cache_mode to be a little less strict
Next
From: Heikki Linnakangas
Date:
Subject: Re: Improve cache hit rate for OprCacheHash