*** ./doc/src/sgml/func.sgml.orig	2008-04-29 23:47:39.378726574 -0400
--- ./doc/src/sgml/func.sgml	2008-04-30 11:31:38.434893712 -0400
***************
*** 10892,10897 ****
--- 10892,10903 ----
        </row>
  
        <row>
+        <entry><literal><function>pg_conf_load_time</function>()</literal></entry>
+        <entry><type>timestamp with time zone</type></entry>
+        <entry>config load time</entry>
+       </row>
+ 
+       <row>
         <entry><literal><function>session_user</function></literal></entry>
         <entry><type>name</type></entry>
         <entry>session user name</entry>
***************
*** 11037,11042 ****
--- 11043,11062 ----
     </para>
  
     <indexterm>
+     <primary>pg_conf_load_time</primary>
+    </indexterm>
+ 
+    <para>
+      <function>pg_conf_load_time</function> returns the
+      <type>timestamp with time zone</type> when the
+      config was last loaded for this session.
+    </para>
+ 
+    <indexterm>
+     <primary>version</primary>
+    </indexterm>
+ 
+    <indexterm>
      <primary>version</primary>
     </indexterm>
  
*** ./src/backend/postmaster/postmaster.c.orig	2008-04-29 23:48:07.374455697 -0400
--- ./src/backend/postmaster/postmaster.c	2008-04-30 12:02:05.156215936 -0400
***************
*** 390,395 ****
--- 390,396 ----
  	InheritableSocket pgStatSock;
  	pid_t		PostmasterPid;
  	TimestampTz PgStartTime;
+ 	TimestampTz PgReloadTime;
  	bool		redirection_done;
  #ifdef WIN32
  	HANDLE		PostmasterHandle;
***************
*** 1008,1013 ****
--- 1009,1015 ----
  	 * Remember postmaster startup time
  	 */
  	PgStartTime = GetCurrentTimestamp();
+ 	PgReloadTime = PgStartTime;
  	/* PostmasterRandom wants its own copy */
  	gettimeofday(&random_start_time, NULL);
  
***************
*** 1931,1936 ****
--- 1933,1943 ----
  		/* Update the starting-point file for future children */
  		write_nondefault_variables(PGC_SIGHUP);
  #endif
+ 
+ 		/*
+ 		 * Remember config load time
+ 		 */
+ 		PgReloadTime = GetCurrentTimestamp();
  	}
  
  	PG_SETMASK(&UnBlockSig);
***************
*** 4263,4268 ****
--- 4270,4276 ----
  
  	param->PostmasterPid = PostmasterPid;
  	param->PgStartTime = PgStartTime;
+ 	param->PgReloadTime = PgReloadTime;
  
  	param->redirection_done = redirection_done;
  
*** ./src/backend/tcop/postgres.c.orig	2008-04-29 23:48:58.866600196 -0400
--- ./src/backend/tcop/postgres.c	2008-04-30 12:21:40.476913468 -0400
***************
*** 58,63 ****
--- 58,64 ----
  #include "storage/ipc.h"
  #include "storage/proc.h"
  #include "storage/sinval.h"
+ #include "storage/spin.h"
  #include "tcop/fastpath.h"
  #include "tcop/pquery.h"
  #include "tcop/tcopprot.h"
***************
*** 3375,3380 ****
--- 3376,3382 ----
  	 */
  	if (!IsUnderPostmaster)
  		PgStartTime = GetCurrentTimestamp();
+ 	PgReloadTime = PgStartTime;
  
  	/*
  	 * POSTGRES main processing loop begins here
***************
*** 3550,3555 ****
--- 3552,3564 ----
  		{
  			got_SIGHUP = false;
  			ProcessConfigFile(PGC_SIGHUP);
+ 
+ 			/*
+ 			 * Remember config load time
+ 			 */
+ 			LWLockAcquire(ReloadTimeLock, LW_EXCLUSIVE);
+ 			PgReloadTime = GetCurrentTimestamp();
+ 			LWLockRelease(ReloadTimeLock);
  		}
  
  		/*
*** ./src/backend/utils/adt/timestamp.c.orig	2008-04-29 23:49:46.359354923 -0400
--- ./src/backend/utils/adt/timestamp.c	2008-04-30 12:23:52.456779063 -0400
***************
*** 42,47 ****
--- 42,49 ----
  
  /* Set at postmaster start */
  TimestampTz PgStartTime;
+ /* Set at configuration reload */
+ TimestampTz PgReloadTime;
  
  
  static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec);
***************
*** 1162,1167 ****
--- 1164,1179 ----
  	PG_RETURN_TIMESTAMPTZ(PgStartTime);
  }
  
+ Datum
+ pgsql_conf_load_time(PG_FUNCTION_ARGS)
+ {
+ 	TimestampTz timestamp;
+ 	LWLockAcquire(ReloadTimeLock, LW_SHARED);
+ 	timestamp = PgReloadTime;
+ 	LWLockRelease(ReloadTimeLock);
+ 	PG_RETURN_TIMESTAMPTZ(timestamp);
+ }
+ 
  /*
   * GetCurrentTimestamp -- get the current operating system time
   *
*** ./src/include/catalog/pg_proc.h.orig	2008-04-29 23:50:10.355694154 -0400
--- ./src/include/catalog/pg_proc.h	2008-04-30 11:30:24.446181191 -0400
***************
*** 3924,3929 ****
--- 3924,3932 ----
  /* start time function */
  DATA(insert OID = 2560 (  pg_postmaster_start_time PGNSP PGUID 12 1 0 f f t f s 0 1184 "" _null_ _null_ _null_ pgsql_postmaster_start_time - _null_ _null_ ));
  DESCR("postmaster start time");
+ /* reload time function */
+ DATA(insert OID = 3775 (  pg_conf_load_time PGNSP PGUID 12 1 0 f f t f s 0 1184 "" _null_ _null_ _null_ pgsql_conf_load_time - _null_ _null_ ));
+ DESCR("configuration load time");
  
  /* new functions for Y-direction rtree opclasses */
  DATA(insert OID = 2562 (  box_below		   PGNSP PGUID 12 1 0 f f t f i 2 16 "603 603" _null_ _null_ _null_ box_below - _null_ _null_ ));
*** ./src/include/utils/timestamp.h.orig	2008-04-29 23:50:58.348372498 -0400
--- ./src/include/utils/timestamp.h	2008-04-30 12:23:49.957160380 -0400
***************
*** 195,200 ****
--- 195,202 ----
  
  /* Set at postmaster start */
  extern TimestampTz PgStartTime;
+ /* Set at configuration reload */
+ extern TimestampTz PgReloadTime;
  
  
  /*
***************
*** 304,309 ****
--- 306,312 ----
  extern Datum clock_timestamp(PG_FUNCTION_ARGS);
  
  extern Datum pgsql_postmaster_start_time(PG_FUNCTION_ARGS);
+ extern Datum pgsql_conf_load_time(PG_FUNCTION_ARGS);
  
  /* Internal routines (not fmgr-callable) */
  