Re: psql not responding to SIGINT upon db reconnection
Jelte Fennema <postgres@jeltef.nl>
From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tristan Partin <tristan@neon.tech>, Heikki Linnakangas <hlinnaka@iki.fi>,
pgsql-hackers@postgresql.org, Shlok Kyal <shlok.kyal.oss@gmail.com>
Date: 2024-04-04T10:43:29Z
Lists: pgsql-hackers
Attachments
- v14-0001-Fix-actually-reachable-pg_unreachable-call.patch (text/x-patch) patch v14-0001
- v14-0002-Change-comment-on-PGRES_POLLING_ACTIVE.patch (text/x-patch) patch v14-0002
On Wed, 3 Apr 2024 at 21:49, Robert Haas <robertmhaas@gmail.com> wrote: > It seems to me that 0001 should either remove the pg_unreachable() > call or change the break to a return, but not both. Updated the patch to only remove the pg_unreachable call (and keep the breaks). > but there's not much value in omitting > pg_unreachable() from unreachable places, either, so I'm not > convinced. But I don't agree with this. Having pg_unreachable in places where it brings no perf benefit has two main downsides: 1. It's extra lines of code 2. If a programmer/reviewer is not careful about maintaining this unreachable invariant (now or in the future), undefined behavior can be introduced quite easily. Also, I'd expect any optimizing compiler to know that the code after the loop is already unreachable if there are no break/goto statements in its body. > I agree with Tristan's analysis of 0002. Updated 0002, to only change the comment. But honestly I don't think using "default" really introduces many chances for future bugs in this case, since it seems very unlikely we'll ever add new variants to the PostgresPollingStatusType enum.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix old, misleading comment for PGRES_POLLING_ACTIVE.
- e57fe3824ee7 17.0 landed
-
Remove reachable call to pg_unreachable().
- 12b964d7815b 17.0 landed
-
Allow SIGINT to cancel psql database reconnections.
- cafe1056558f 17.0 landed
-
Expose PQsocketPoll via libpq
- f5e4dedfa81f 17.0 landed
-
Fix query cancellation handling in psql
- 5d43c3c54d77 13.0 cited