Re: DB alias ?

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Shridhar Daithankar <ghodechhap(at)ghodechhap(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>
Subject: Re: DB alias ?
Date: 2013-01-24 14:16:53
Message-ID: 0AD01C53605506449BA127FB8B99E5E16112D1AA@FMSMSX105.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Shridhar Daithankar
Sent: Wednesday, January 23, 2013 10:32 PM
To: pgsql-general(at)postgresql(dot)org
Cc: Gauthier, Dave; Rob Sargent
Subject: Re: [GENERAL] DB alias ?

On Wednesday, January 23, 2013 09:39:43 PM Gauthier, Dave wrote:

> 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 layer on 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;

I would have suggested to use pg_services file as documented at

http://www.postgresql.org/docs/9.1/static/libpq-pgservice.html

http://www.postgresql.org/docs/9.1/static/libpq-connect.html

You can think of this as tnsnames replacement.

but I am unable to make it work. I don't know what is wrong with this.

shridhar(at)bheem ~$ cat ~/.pg_service.conf

[test1]

host=localhost

dbname=test

shridhar(at)bheem ~$ strace -o psql.strace psql test1

psql: FATAL: database "test1" does not exist

shridhar(at)bheem ~$ grep -i pg_service psql.strace

shridhar(at)bheem ~$ psql test

psql (9.2.2)

Type "help" for help.

test=# \q

shridhar(at)bheem ~$ psql --version

psql (PostgreSQL) 9.2.2

--

Regards

Shridhar

---------------------------------------------------------------------------------------------

The services file looked/looks interesting, but there are far too many clients, and at multiple sites, to manage this. I really need something on the server side, a single place to manage this for all connections regardless of where they are coming from. It also looks like a C lib based file, something I won't have access to except, maybe, through an app designed for DBAs to edit this file. If I am mistaken, and the services file is in the DB root area (the area specified after the "-D" in commands like pg_ctl), then maybe this is still viable. But I don't see a services file there :-(

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2013-01-24 14:39:27 Re: Optimizing select count query which often takes over 10 seconds
Previous Message Andrew Dunstan 2013-01-24 13:50:36 Re: BUG #6510: A simple prompt is displayed using wrong charset