? src/backend/catalog/.dependency.c.swp 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 12:35:30 *************** *** 17,22 **** --- 17,23 ---- #include #include "postgres.h" + #include "miscadmin.h" #include "utils/builtins.h" *************** *** 110,113 **** --- 111,130 ---- int32 i = PG_GETARG_INT32(0); PG_RETURN_INT32(i); + } + + /* + * current_database() + * Expose the current database to the user + */ + Datum + current_database(PG_FUNCTION_ARGS) + { + Name db; + + db = (Name) palloc(NAMEDATALEN); + + namestrcpy(db, DatabaseName); + + PG_RETURN_NAME(db); } Index: src/include/catalog/pg_proc.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/catalog/pg_proc.h,v retrieving revision 1.248 diff -c -r1.248 pg_proc.h *** src/include/catalog/pg_proc.h 2002/07/31 01:49:13 1.248 --- src/include/catalog/pg_proc.h 2002/08/07 12:36:24 *************** *** 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/include/utils/builtins.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/utils/builtins.h,v retrieving revision 1.188 diff -c -r1.188 builtins.h *** src/include/utils/builtins.h 2002/07/29 22:14:11 1.188 --- src/include/utils/builtins.h 2002/08/07 12:36:33 *************** *** 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);