Automating logins for mundane chores

Поиск
Список
Период
Сортировка
От Phoenix Kiula
Тема Automating logins for mundane chores
Дата
Msg-id e373d31e0708180320q2183b129kd3bde806664bc9ae@mail.gmail.com
обсуждение исходный текст
Ответы Re: Automating logins for mundane chores
Re: Automating logins for mundane chores
Список pgsql-general
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).

So I read up on .pgpass. Where should this file be located. "User's
home directory" says the manual, but there's no "home directory" for
database users (or is there? if so, where?), only for the postgres
user. So I promptly did "su - postgres" and added the requisite info
in the .pgpass file therein. But that doesn't seem to automate
anything for actual DB users.

Next, the manual refers to some PGPASSFILE env variable (
http://www.postgresql.org/docs/8.2/interactive/libpq-envars.html ) but
it is unclear where this environment is set up. I don't see any such
setting in the postgresql.conf file, which wouldn't make much sense
anyway. Where else can I tweak the environment variables? No pointer
in the manual.  Or was this page only some arcane C libpg stuff?

So, my questions:

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.

2. While we're on psql, I quite like the "\timing" stuff inside psql.
I find it very useful to have that on every time I login to psql
console, but I don't see any command line option to automate this
every time. The psql man page (
http://www.postgresql.org/docs/8.2/interactive/app-psql.html ) talks
about a "psqlrc", which on my system is found at
"/usr/share/pgsql/psqlrc" so I opened it up, entered the only line:

   \timing

And saved it. Then I started the psql console again, but there's no
timing on by default. How can I setup default options for psql?

Many TIA!

В списке pgsql-general по дате отправления:

Предыдущее
От: Julio Cesar Sánchez González
Дата:
Сообщение: Partitioning
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Automating logins for mundane chores