dbTalk Databases Forums  

Re: [HACKERS] [BUGS] pg_service.conf ignores dbname parameter

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [HACKERS] [BUGS] pg_service.conf ignores dbname parameter in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [HACKERS] [BUGS] pg_service.conf ignores dbname parameter - 12-17-2003 , 11:54 AM






Tom Lane wrote:
Quote:
Michael Fuhr <mfuhr (AT) fuhr (DOT) org> writes:
When a client connects to the database server using a service name,
the dbname parameter in pg_service.conf is ignored. In the absence
of an explicitly-named database in the connection string, the service
name is used as the database name regardless of that service's
dbname setting.
[snip]
I haven't yet examined the rest of the code closely enough to come
up with the correct patch, but it seems that the "set the database
name to the name of the service" code should be deferred until
after all of the service's parameters have been read.

Hm. I'm of the opinion that the real problem here is the code's
assumption that it is reasonable to force dbname = servicename when
the service file doesn't say any such thing. For all other parameters,
omitting the parameter from pg_service.conf causes the standard default
to be adopted. Why should dbname work differently? It saves only a
minimal amount of typing to do it this way, and it might prevent some
useful setups (namely, a service that specifies connection params but
allows the usual default of dbname = username to apply).

Since pg_service was completely undocumented before 7.4, I think it is
safe to say that its usage in the field is nil except for the original
author, and therefore "backwards compatibility" is not really a relevant
argument just yet. We ought to concentrate on "principle of least
astonishment" instead.

Accordingly, I'd rather just delete the offending code instead of move
it. (BTW, I notice Bruce has fooled with this code before, so it's
already in the "known source of problems" category.)
Agreed. Just make them supply the dbname in the service file. I can
make the changes and update the documentation in pg_service.conf:

# included in this file. If no database name is specified, it is assumed
# to match the service name. Lines beginning with '#' are comments.

--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.