Skip to content

Commit 965213d

Browse files
committed
Use more mundane 'int' type for cancel key lengths in libpq
The documented max length of a cancel key is 256 bytes, so it fits in uint8. It nevertheless seems weird to not just use 'int', like in commit 0f1433f for the backend. Discussion: https://www.postgresql.org/message-id/61be9e31-7b7d-49d5-bc11-721800d89d64%40eisentraut.org
1 parent 9d710a1 commit 965213d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/interfaces/libpq/fe-protocol3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ getParameterStatus(PGconn *conn)
15321532
static int
15331533
getBackendKeyData(PGconn *conn, int msgLength)
15341534
{
1535-
uint8 cancel_key_len;
1535+
int cancel_key_len;
15361536

15371537
if (conn->be_cancel_key)
15381538
{

src/interfaces/libpq/libpq-int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ struct pg_conn
547547

548548
/* Miscellaneous stuff */
549549
int be_pid; /* PID of backend --- needed for cancels */
550+
int be_cancel_key_len;
550551
char *be_cancel_key; /* query cancellation key and its length */
551-
uint16 be_cancel_key_len;
552552
pgParameterStatus *pstatus; /* ParameterStatus data */
553553
int client_encoding; /* encoding id */
554554
bool std_strings; /* standard_conforming_strings */

0 commit comments

Comments
 (0)