Re: BUG #17824: PQTRANS_ACTIVE misleading - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17824: PQTRANS_ACTIVE misleading
Date
Msg-id CAKFQuwb0bADD37jeNGLhGQugA2ok0d4q-_zKc8ja0QGupiGv8w@mail.gmail.com
Whole thread Raw
In response to BUG #17824: PQTRANS_ACTIVE misleading  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Wed, Mar 8, 2023 at 8:28 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17824
Logged by:          Andy Schoenberger
Email address:      akschoenberger@gmail.com
PostgreSQL version: 15.2
Operating system:   All
Description:       

The documentation for PQTRANS_ACTIVE [1] does not make explicitly clear that
it is returned in *all* cases where there is a command in progress on an
okay connection, and not just in the case that there is a command in
progress inside of a transaction [2]. With a name like PQTRANS_ACTIVE, I
believe it is worth making clear that it can happen when a transaction is
not active.

It is not possible for the server to execute a command without there being an active transaction in progress.


…but a `*` character is also technically used if the transaction status is
PQTRANS_ACTIVE, which does not necessarily happen during a transaction.
https://github.com/postgres/postgres/blob/46d490ac19a7ca93a5c0f47e5a0e759b5385a8ae/src/bin/psql/prompt.c#L236

I’m not sure if this is actually considered a bug or not since I don’t think
psql displays a new prompt until after the command completes, but the logic
in the code being misleading does not help.

Right, it is difficult to report on/see the implicit transaction that occurs if you send a command to the server without constructing an explicit transaction block, since it goes away as the command execution ends.

David J.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_basebackup fails with Could not stat file or directory "./.pg_hba.conf.un~"
Next
From: Tom Lane
Date:
Subject: Re: BUG #17824: PQTRANS_ACTIVE misleading