On Feb 13, 2004, at 6:05 PM, Ron St-Pierre wrote:
I am using postgres 7.3.4 and need to be able to determine which database a query is being run in (from a script). pg_database lists databases but doesn't tell me which one is currently active. Is there a query I can use along the lines of:
The built-in function "current_database()" returns the current database name.
=# select current_database(); current_database ------------------ testing (1 row)
Use it in your update statements too.
eric
That's exactly what I need!
Joe Conway wrote:
See: http://www.postgresql.org/docs/7.3/static/functions-misc.html
Thanks guys. I was searching the docs looking for functions starting with pg_
Ron
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html