Re: How to determine current database? - Mailing list pgsql-general

From Ron St-Pierre
Subject Re: How to determine current database?
Date
Msg-id 402D702C.5010605@syscor.com
Whole thread Raw
In response to Re: How to determine current database?  (Eric Ridge <ebr@tcdi.com>)
List pgsql-general
Eric Ridge wrote:

> 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to determine current database?
Next
From: Mark Kirkwood
Date:
Subject: Re: Quad Xeon vs. Dual Itanium