Phoenix Kiula wrote: > On 18/08/07, Magnus Hagander <magnus@xxxxxxxxxxxx> wrote: >> Phoenix Kiula wrote: >>> I am writing some simple batch scripts to login to the DB and do a >>> pg_dump. Also, when I login to do my own SQL tinkering, I'd like not >>> to be asked for a password every time (which, for silly corporate >>> reasons, is quite a convoluted one). >>> >> It's in the environment on the client machine. If it's for your scripts, >> you can set it inside the script before you launch psql for example. If >> you need it. > > > Let's say my script was in Perl or PHP. What would the variable name > be to set this password? My script is unlikely to call psql, I'm > thinking of using only pg_dump and pg_restore. As long as the interfaced is based off libpq, .pgpass will work. AFAIK, this includes both Perl and PHP, and it certainly includes pg_dump and pg_restore. >>> 1. Where do I set up the automated password for (a) psql stuff and (b) >>> for bash scripts or cron jobs -- I suppose both could have the same >>> solution. >> a) In the home directory of the user running psql. >> b) In the home directory of the user running the cronjob. > > > Thanks for this. I am logged in as root. Put it there and it works. I > also put a ".psqlrc" in the home directory and that works too! Thanks! > > I'd love to contribute back to the community and mention this in the > manual for 8.2/interactive. But the community login and commenting on > the site seems to be broken! Even after I am logged in, it does not > show it on each page of the site, and when I submit my comment (and > login all over again for it) it shows me a "numeric error". Where > should I post that error? It will appear on the site once it's been approved. But if you get an actual error, than that needs to be fixed - please email the complete error you get to the pgsql-www@xxxxxxxxxxxxxx mailinglist. Thanks! //Magnus ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq