Authorization denial should result in error+ready-for-query - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket(s)
Description
BuildAccessDeniedResponsewas usingpostgres.BuildTerminateWithError, which buildsErrorResponse+pgproto3.Terminate(type byte'X'). TheTerminatemessage is a frontend (client-to-server) message in the PostgreSQL wire protocol, so sending it from the server to the client during query execution causespsql/libpqto encounter an invalid backend message type and hang indefinitely.This changes
BuildAccessDeniedResponseto buildErrorResponse+ReadyForQueryinstead.ReadyForQuery(type'Z', transaction status'I') is the correct PostgreSQL protocol response after a query error — it tells the client the server is ready for the next command and keeps the session open.BuildAuthFailResponse(for wrong passwords) is left unchanged, sinceTerminateis appropriate there — the connection is being rejected during the startup/auth phase.Related PRs
Development Checklist
Legal Checklist