Re: BUG #10123: Weird entries in pg_stat_activity - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #10123: Weird entries in pg_stat_activity
Date
Msg-id 474.1398357435@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #10123: Weird entries in pg_stat_activity  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: BUG #10123: Weird entries in pg_stat_activity  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-bugs
Andres Freund <andres@2ndquadrant.com> writes:
> I think there's a pgstat_report_xact_timestamp(0) missing from
> xact.c:PrepareTransaction(). There's no point in reporting a prepared
> xact's starttime in a backend that's not associated with it anymore.

> Maxim, are you using prepared transactions?

Even if he were, that wouldn't explain this report, because the displayed
latest-query would have to have been a PREPARE TRANSACTION, no?

However, regardless of exactly what's going on here, I think you're
probably right that PrepareTransaction ought to do
pgstat_report_xact_timestamp(0) once it exits the transaction state
locally.  The definition of that field is that it's null whenever the
session isn't inside a transaction, and once we do PREPARE, we aren't.

            regards, tom lane

pgsql-bugs by date:

Previous
From: tcoq
Date:
Subject: LOG: incomplete message from client
Next
From: Andres Freund
Date:
Subject: Re: BUG #10123: Weird entries in pg_stat_activity