Index: src/include/utils/builtins.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/utils/builtins.h,v
retrieving revision 1.189
diff -c -r1.189 builtins.h
*** src/include/utils/builtins.h	2002/08/06 14:11:05	1.189
--- src/include/utils/builtins.h	2002/08/07 00:34:44
***************
*** 291,296 ****
--- 291,297 ----
  extern Datum oidrand(PG_FUNCTION_ARGS);
  extern Datum oidsrand(PG_FUNCTION_ARGS);
  extern Datum userfntest(PG_FUNCTION_ARGS);
+ extern Datum current_database(PG_FUNCTION_ARGS);
  
  /* not_in.c */
  extern Datum int4notin(PG_FUNCTION_ARGS);
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/catalog/pg_proc.h,v
retrieving revision 1.252
diff -c -r1.252 pg_proc.h
*** src/include/catalog/pg_proc.h	2002/08/06 05:40:45	1.252
--- src/include/catalog/pg_proc.h	2002/08/07 00:35:29
***************
*** 1106,1111 ****
--- 1106,1114 ----
  DATA(insert OID =  860 (  bpchar		   PGNSP PGUID 12 f f t f i 1 1042 "18"  char_bpchar - _null_ ));
  DESCR("convert char to char()");
  
+ DATA(insert OID = 861 ( current_database       PGNSP PGUID 12 f f t f i 0 19 "0" current_database - _null_ ));
+ DESCR("returns the current database");
+ 
  DATA(insert OID =  862 (  int4_mul_cash		   PGNSP PGUID 12 f f t f i 2 790 "23 790"  int4_mul_cash - _null_ ));
  DESCR("multiply");
  DATA(insert OID =  863 (  int2_mul_cash		   PGNSP PGUID 12 f f t f i 2 790 "21 790"  int2_mul_cash - _null_ ));
Index: src/backend/utils/adt/misc.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/misc.c,v
retrieving revision 1.24
diff -c -r1.24 misc.c
*** src/backend/utils/adt/misc.c	2002/06/20 20:29:37	1.24
--- src/backend/utils/adt/misc.c	2002/08/07 00:35:29
***************
*** 17,22 ****
--- 17,23 ----
  #include <time.h>
  
  #include "postgres.h"
+ #include "miscadmin.h"
  
  #include "utils/builtins.h"
  
***************
*** 110,113 ****
--- 111,120 ----
  	int32		i = PG_GETARG_INT32(0);
  
  	PG_RETURN_INT32(i);
+ }
+ 
+ Datum
+ current_database(PG_FUNCTION_ARGS)
+ {
+ 	PG_RETURN_NAME(DatabaseName);
  }
