Re: BackendKeyData is mandatory?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: BackendKeyData is mandatory?
Date: 2025-06-17 02:46:10
Message-ID: 716844.1750128370@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <ishii(at)postgresql(dot)org> writes:
> In the Frontend/Backend protocol, it is explained that after
> successful authentication following messages can be sent from backend
> to frontend[1]:

> BackendKeyData
> ParameterStatus
> ReadyForQuery
> ErrorResponse
> NoticeResponse

> My question is, BackendKeyData is mandatory or not. Currently
> Pgpool-II raises a fatal error if BackendKeyData is not sent before
> ReadyForQuery arrives. This is because without the message, frontend
> cannot send a CancelRequest message later on, as there's no secret
> key.

As you say, without BackendKeyData it's impossible to send a query
cancel, so we expect the server will always send that.

> I heard that some "PostgreSQL compatible" servers do not send
> BackendKeyData message to frontend. I wonder if this is a protocol
> violation.

I'd say so. Maybe whoever that is doesn't care to support query
cancel. They're within their rights to do that I guess, but
Pgpool-II does not have to support the case. (A less incompatible
way of not supporting query cancel is to send dummy BackendKeyData
values and then just ignore cancel requests. So I don't see that
you need to do anything towards this goal, if it is a goal and
not merely a broken implementation.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-06-17 02:54:41 Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly
Previous Message Vaibhav Dalvi 2025-06-17 02:44:07 Re: pg_upgrade fails with an error "object doesn't exist"