Ron St-Pierre <rstpierre(at)syscor(dot)com> writes:
> 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).
See current_database():
http://www.postgresql.org/docs/7.4/static/functions-misc.html
regards, tom lane