Hi!

I have been working on some servers that haven't been shut down or restarted 
for many days. As a result, the need arose to use the function 
'pg_postmaster_start_time' (which I had completely forgotten existed).

While working with it, I realized that it would be more appropriate for its 
name to be 'pg_postgres_start_time', to align with the name of the main process 
displayed by the operating system. The process, which was previously known as 
"postmaster," has long been referred to as "postgres".

I suggest this change to simplify the terminology and make the function name 
more intuitive, as "postgres" directly refers to the database server. This 
seems more suitable to me.
Attached is the patch with the suggest adjustment.

Result:

[postgres@192 bin]$ pwd
/pgsql18devel/18devel_bin/bin
[postgres@192 bin]$ ./psql -p 5454 -h ::1
psql (18devel)
Type "help" for help.

postgres=# select pg_postgres_start_time();
    pg_postgres_start_time
-------------------------------
 2024-11-05 14:52:42.463293-03
(1 row)

Regards,
Maiquel Grassi.
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 73979f20ff..44285ab393 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -24816,9 +24816,9 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
       <row>
        <entry role="func_table_entry"><para role="func_signature">
         <indexterm>
-         <primary>pg_postmaster_start_time</primary>
+         <primary>pg_postgres_start_time</primary>
         </indexterm>
-        <function>pg_postmaster_start_time</function> ()
+        <function>pg_postgres_start_time</function> ()
         <returnvalue>timestamp with time zone</returnvalue>
        </para>
        <para>
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index e00cd3c969..7b176a4970 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -49,7 +49,7 @@
 
 #define SAMESIGN(a,b)	(((a) < 0) == ((b) < 0))
 
-/* Set at postmaster start */
+/* Set at postgres start */
 TimestampTz PgStartTime;
 
 /* Set at configuration reload */
@@ -1623,7 +1623,7 @@ clock_timestamp(PG_FUNCTION_ARGS)
 }
 
 Datum
-pg_postmaster_start_time(PG_FUNCTION_ARGS)
+pg_postgres_start_time(PG_FUNCTION_ARGS)
 {
 	PG_RETURN_TIMESTAMPTZ(PgStartTime);
 }
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index f23321a41f..052dbe1548 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -8587,9 +8587,9 @@
 
 # start time function
 { oid => '2560', descr => 'postmaster start time',
-  proname => 'pg_postmaster_start_time', provolatile => 's',
+  proname => 'pg_postgres_start_time', provolatile => 's',
   prorettype => 'timestamptz', proargtypes => '',
-  prosrc => 'pg_postmaster_start_time' },
+  prosrc => 'pg_postgres_start_time' },
 
 # config reload time function
 { oid => '2034', descr => 'configuration load time',

Reply via email to