Using result from current_database() into another command?

From: Francisco Reyes <lists(at)stringsutils(dot)com>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Using result from current_database() into another command?
Date: 2007-07-24 15:51:36
Message-ID: cone.1185292296.765747.18024.5001@35st.simplicato.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select current_database();
current_database
------------------
test2

Is there a way to use that result from current_database() into something
like:
alter database CURRENT_DATABASE() set search_path=myschema,public;

I have some generic scripts that I am preparing for several databases. Most
commands/loads don't care about the database, since they just use the one I
am connected to. Alter database however needs the database specified.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2007-07-24 16:02:09 Re: Connection error
Previous Message Steve Wampler 2007-07-24 15:45:57 Re: CentOS 4 RPMs for 8.2.4?