dbTalk Databases Forums  

[BUGS] Do dropdb and createdb read password from .pgpass file?

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


Discuss [BUGS] Do dropdb and createdb read password from .pgpass file? in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sankaran Anupama
 
Posts: n/a

Default [BUGS] Do dropdb and createdb read password from .pgpass file? - 05-12-2005 , 12:36 AM






Hi,

I'm using the pg_dump and pg_restore client applications to implement
our database backup-restore strategies. Wrt this, inorder to be able to
autoamate the backup process (run it as a cron job), I'm using the
..pgpass file for automating the password input. This is working for
pg_dump.

My restore script does a full restore - I first drop the existing
database using dropdb, create a new database using createdb and then use
pg_restore to restore the database from the backup file created (using
pg_dump)

I find that while pg_dump and pg_restore take/read the password from
the .pgpass file, dropdb and createdb do not. For these, i'm still
having to key in the password. The permissions for the .pgpass is 0600
as expected.

Can anyone please let me know why this is happening? Thanks.

-Anu

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] Do dropdb and createdb read password from .pgpass file? - 05-12-2005 , 08:24 AM






On Wed, May 11, 2005 at 11:35:16PM -0600, Sankaran Anupama wrote:
Quote:
I find that while pg_dump and pg_restore take/read the password from
the .pgpass file, dropdb and createdb do not. For these, i'm still
having to key in the password. The permissions for the .pgpass is 0600
as expected.
Using .pgpass is a behavior of libpq, which underlies utilities
like pg_dump, createdb, and dropdb. If createdb and dropdb are
linked against a libpq from PostgreSQL 7.3 or later, then they
should be using .pgpass. Have you done a process trace or examined
the access time of .pgpass to test your hypothesis that createdb
and dropdb don't use it? Have you used the --version option to
verify that the correct versions of those utilites are being used,
or ldd to see which libpq they're linked against?

createdb and dropdb make connections to template1. Have you checked
pg_hba.conf to see if connecting to template1 is different than
connecting to other databases?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


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.