mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Rename recently-added pg_stat_activity column from txn_start to xact_start,
for consistency with other column names such as in pg_stat_database.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.250 2007/09/08 20:31:14 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.251 2007/09/11 03:28:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1454,7 +1454,7 @@ StartTransaction(void)
|
||||
*/
|
||||
xactStartTimestamp = stmtStartTimestamp;
|
||||
xactStopTimestamp = 0;
|
||||
pgstat_report_txn_timestamp(xactStartTimestamp);
|
||||
pgstat_report_xact_timestamp(xactStartTimestamp);
|
||||
|
||||
/*
|
||||
* initialize current transaction state fields
|
||||
@@ -1648,7 +1648,7 @@ CommitTransaction(void)
|
||||
AtEOXact_ComboCid();
|
||||
AtEOXact_HashTables(true);
|
||||
AtEOXact_PgStat(true);
|
||||
pgstat_report_txn_timestamp(0);
|
||||
pgstat_report_xact_timestamp(0);
|
||||
|
||||
CurrentResourceOwner = NULL;
|
||||
ResourceOwnerDelete(TopTransactionResourceOwner);
|
||||
@@ -1999,7 +1999,7 @@ AbortTransaction(void)
|
||||
AtEOXact_ComboCid();
|
||||
AtEOXact_HashTables(false);
|
||||
AtEOXact_PgStat(false);
|
||||
pgstat_report_txn_timestamp(0);
|
||||
pgstat_report_xact_timestamp(0);
|
||||
|
||||
/*
|
||||
* State remains TRANS_ABORT until CleanupTransaction().
|
||||
|
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.42 2007/09/05 18:10:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.43 2007/09/11 03:28:05 tgl Exp $
|
||||
*/
|
||||
|
||||
CREATE VIEW pg_roles AS
|
||||
@@ -347,7 +347,7 @@ CREATE VIEW pg_stat_activity AS
|
||||
U.rolname AS usename,
|
||||
pg_stat_get_backend_activity(S.backendid) AS current_query,
|
||||
pg_stat_get_backend_waiting(S.backendid) AS waiting,
|
||||
pg_stat_get_backend_txn_start(S.backendid) AS txn_start,
|
||||
pg_stat_get_backend_xact_start(S.backendid) AS xact_start,
|
||||
pg_stat_get_backend_activity_start(S.backendid) AS query_start,
|
||||
pg_stat_get_backend_start(S.backendid) AS backend_start,
|
||||
pg_stat_get_backend_client_addr(S.backendid) AS client_addr,
|
||||
|
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.162 2007/08/02 23:39:44 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.163 2007/09/11 03:28:05 tgl Exp $
|
||||
* ----------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@@ -1854,7 +1854,7 @@ pgstat_bestart(void)
|
||||
beentry->st_procpid = MyProcPid;
|
||||
beentry->st_proc_start_timestamp = proc_start_timestamp;
|
||||
beentry->st_activity_start_timestamp = 0;
|
||||
beentry->st_txn_start_timestamp = 0;
|
||||
beentry->st_xact_start_timestamp = 0;
|
||||
beentry->st_databaseid = MyDatabaseId;
|
||||
beentry->st_userid = userid;
|
||||
beentry->st_clientaddr = clientaddr;
|
||||
@@ -1939,12 +1939,11 @@ pgstat_report_activity(const char *cmd_str)
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the current transaction start timestamp to the specified
|
||||
* value. If there is no current active transaction, this is signified
|
||||
* by 0.
|
||||
* Report current transaction start timestamp as the specified value.
|
||||
* Zero means there is no active transaction.
|
||||
*/
|
||||
void
|
||||
pgstat_report_txn_timestamp(TimestampTz tstamp)
|
||||
pgstat_report_xact_timestamp(TimestampTz tstamp)
|
||||
{
|
||||
volatile PgBackendStatus *beentry = MyBEEntry;
|
||||
|
||||
@@ -1957,7 +1956,7 @@ pgstat_report_txn_timestamp(TimestampTz tstamp)
|
||||
* here to ensure the compiler doesn't try to get cute.
|
||||
*/
|
||||
beentry->st_changecount++;
|
||||
beentry->st_txn_start_timestamp = tstamp;
|
||||
beentry->st_xact_start_timestamp = tstamp;
|
||||
beentry->st_changecount++;
|
||||
Assert((beentry->st_changecount & 1) == 0);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.43 2007/06/28 00:02:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.44 2007/09/11 03:28:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ extern Datum pg_stat_get_backend_userid(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_activity(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_waiting(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_txn_start(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_xact_start(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_start(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_backend_client_port(PG_FUNCTION_ARGS);
|
||||
@@ -464,7 +464,7 @@ pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS)
|
||||
|
||||
|
||||
Datum
|
||||
pg_stat_get_backend_txn_start(PG_FUNCTION_ARGS)
|
||||
pg_stat_get_backend_xact_start(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int32 beid = PG_GETARG_INT32(0);
|
||||
TimestampTz result;
|
||||
@@ -476,7 +476,7 @@ pg_stat_get_backend_txn_start(PG_FUNCTION_ARGS)
|
||||
if (!superuser() && beentry->st_userid != GetUserId())
|
||||
PG_RETURN_NULL();
|
||||
|
||||
result = beentry->st_txn_start_timestamp;
|
||||
result = beentry->st_xact_start_timestamp;
|
||||
|
||||
if (result == 0) /* not in a transaction */
|
||||
PG_RETURN_NULL();
|
||||
|
Reference in New Issue
Block a user