From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Francisco Reyes <lists(at)stringsutils(dot)com> |
Cc: | PostgreSQL general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Using result from current_database() into another command? |
Date: | 2007-07-24 16:12:17 |
Message-ID: | 46A624E1.7080803@commandprompt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Francisco Reyes wrote:
> 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.
You could use it in plpgsql with EXECUTE.
Joshua D. Drake
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/
From | Date | Subject | |
---|---|---|---|
Next Message | Viatcheslav Kalinin | 2007-07-24 16:19:07 | Pattern matching with index |
Previous Message | Denis Gasparin | 2007-07-24 16:09:59 | Re: Strange behaviour with Xfs filesystem and unix_socket_directory |