From: | Ron St-Pierre <rstpierre(at)syscor(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to determine current database? |
Date: | 2004-02-14 00:47:40 |
Message-ID: | 402D702C.5010605@syscor.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Kirkwood | 2004-02-14 01:29:49 | Re: Quad Xeon vs. Dual Itanium |
Previous Message | Tom Lane | 2004-02-14 00:41:23 | Re: How to determine current database? |