aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-07-31 00:40:40 +0000
committerBruce Momjian <bruce@momjian.us>2002-07-31 00:40:40 +0000
commitf67cb71961afa8144f76aabeb096538a91543d0b (patch)
treeededb4896ca4dedff554a34dcb86e144df7c2c9b
parentb8efa8755c2d26589b83b82ce664798f3a7b42fd (diff)
downloadpostgresql-f67cb71961afa8144f76aabeb096538a91543d0b.tar.gz
postgresql-f67cb71961afa8144f76aabeb096538a91543d0b.zip
Add function to access backend pid, pg_stat_get_backend_mypid.
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c8
-rw-r--r--src/include/catalog/pg_proc.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index b5f3744d510..6780665a11d 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -19,6 +19,7 @@ extern Datum pg_stat_get_blocks_fetched(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_blocks_hit(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_backend_idset(PG_FUNCTION_ARGS);
+extern Datum pg_stat_get_backend_mypid(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_backend_pid(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_backend_dbid(PG_FUNCTION_ARGS);
extern Datum pg_stat_get_backend_userid(PG_FUNCTION_ARGS);
@@ -212,6 +213,13 @@ pg_stat_get_backend_idset(PG_FUNCTION_ARGS)
Datum
+pg_stat_get_backend_mypid(PG_FUNCTION_ARGS)
+{
+ PG_RETURN_INT32(MyProcPid);
+}
+
+
+Datum
pg_stat_get_backend_pid(PG_FUNCTION_ARGS)
{
PgStat_StatBeEntry *beentry;
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index c674c214ee5..66f4ea8a2c6 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.246 2002/07/24 19:11:13 petere Exp $
+ * $Id: pg_proc.h,v 1.247 2002/07/31 00:40:40 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2703,6 +2703,8 @@ DATA(insert OID = 1935 ( pg_stat_get_blocks_hit PGNSP PGUID 12 f f t f s 1 20
DESCR("Statistics: Number of blocks found in cache");
DATA(insert OID = 1936 ( pg_stat_get_backend_idset PGNSP PGUID 12 f f t t s 0 23 "" pg_stat_get_backend_idset - _null_ ));
DESCR("Statistics: Currently active backend IDs");
+DATA(insert OID = 2026 ( pg_stat_get_backend_mypid PGNSP PGUID 12 f f t f s 0 23 "" pg_stat_get_backend_mypid - _null_ ));
+DESCR("Statistics: My backend ID");
DATA(insert OID = 1937 ( pg_stat_get_backend_pid PGNSP PGUID 12 f f t f s 1 23 "23" pg_stat_get_backend_pid - _null_ ));
DESCR("Statistics: PID of backend");
DATA(insert OID = 1938 ( pg_stat_get_backend_dbid PGNSP PGUID 12 f f t f s 1 26 "23" pg_stat_get_backend_dbid - _null_ ));