Re: DB alias ? - Mailing list pgsql-general

From Gauthier, Dave
Subject Re: DB alias ?
Date
Msg-id 0AD01C53605506449BA127FB8B99E5E16112D085@FMSMSX105.amr.corp.intel.com
Whole thread Raw
In response to Re: DB alias ?  (Rob Sargent <robjsargent@gmail.com>)
Responses Re: DB alias ?  (Shridhar Daithankar <ghodechhap@ghodechhap.net>)
List pgsql-general
Then someone who wants to look at old JAN data will have the same problem :-(

If I recall, Oracle enables something like this.  Multiple tnsfilenames (or something like that).  There was a connect
layeron the server side that the DBA had access to where you could do stuff like this. 

>> proposed new SQL command:
>>READ USERS MIND;

:-)
Actually, read the DBA's mind.

How about...

postgres=# create db_alias FEB to db JAN;
postgres=# drop db_alias FEB;



-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Rob Sargent
Sent: Wednesday, January 23, 2013 4:16 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] DB alias ?

On 01/23/2013 02:10 PM, Gauthier, Dave wrote:
> Nope.  Think of it this way, a new DB is created on day 1 of every month.  So there's a DB called JAN, another called
FEB,etc... .  The DB name used in the connect is picked up from the current date/time.  But January is oevr and I don't
wantto create the FEB DB until Feb 15th.  In the meantime, I want those who try to connect to FEB to connect to JAN
(forexample). 
>
> -----Original Message-----
> From: Joshua D. Drake [mailto:jd@commandprompt.com]
> Sent: Wednesday, January 23, 2013 4:04 PM
> To: Gauthier, Dave
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] DB alias ?
>
>
> On 01/23/2013 12:45 PM, Gauthier, Dave wrote:
>> Problem:  Some users (scripts actually) try to connect to a DB who's
>> name is derived from environmental variables.  The DB doesn't exist
>> (yet), and I want them to connect to a different DB for the time being.
>> Is there a way to define an alias for the existing DB that = the db name
>> that doesn't exist?    Or is there a way to have PG fail over to a
>> default DB should a DB connect fail?  I can implement the fail over
>> outside PG, but those users who make a direct connect to the DB don't
>> use that code.
>
> Pass the database name when you connect?
>
> JD
>
>
>>
>> Thanks in Advance
>>
>
>
> --
> Command Prompt, Inc. - http://www.commandprompt.com/ PostgreSQL
> Support, Training, Professional Services and Development High
> Availability, Oracle Conversion, Postgres-XC @cmdpromptinc -
> 509-416-6579
>
>
alter database JAN rename to FEB;


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: DB alias ?
Next
From: ERR ORR
Date:
Subject: Re: Fwd: Question on Trigram GIST indexes