Re: pgsql: Make cancel request keys longer - Mailing list pgsql-committers

From Heikki Linnakangas
Subject Re: pgsql: Make cancel request keys longer
Date
Msg-id 34d5d731-06cc-43af-88cd-b3a4c5c8d9df@iki.fi
Whole thread Raw
In response to Re: pgsql: Make cancel request keys longer  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: pgsql: Make cancel request keys longer
List pgsql-committers
On 08/04/2025 22:41, Heikki Linnakangas wrote:
> On 08/04/2025 20:06, Peter Eisentraut wrote:
>> While I was looking at this, I suggest to make the first argument void 
>> *.  This is consistent for passing binary data.
> 
> Ok, sure.

On second thoughts, -1 on that. 'void *' is appropriate for functions 
like libc's read() or pq_sendbytes(), where the buffer can point to 
anything. In other words, the caller is expected to have a pointer like 
'foobar *', and it gets cast to 'void *' when you call the function. 
That's not the case with the cancellation key. The cancellation key is 
just an array of bytes, the caller is expected to pass an array of 
bytes, not a struct.

The right precedent for that are e.g. SCRAM functions in scram-common.h, 
for example. They use "const uint8 *" for the hashes.

I'll switch to "const uint *" everywhere that deals with cancel keys. 
There are a few more variables elsewhere in the backend and in libpq.

> Looks good to me. I can commit these tomorrow, or feel free to do it 
> yourself too.

I'm on this now.

-- 
Heikki Linnakangas
Neon (https://neon.tech)




pgsql-committers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: pgsql: Perform missed catversion bump
Next
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Make cancel request keys longer