request for feature: psql "DSN" option

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема request for feature: psql "DSN" option
Дата
Msg-id 87ac7mvx2t.fsf@wolfe.cbbrowne.com
обсуждение исходный текст
Ответ на HELP all women were raped during the May riots in Jakarta  (adm@pu.go.id)
Ответы Re: request for feature: psql 'DSN' option  ("Andrew Dunstan" <andrew@dunslane.net>)
Список pgsql-hackers
Per tonight's dinner discussion, it Sure Would Be Nice if psql had an
additional option that allowed passing in a conninfo string.

The notion:  Plenty of libraries out there like Pg, DBI::Pg, and such
make you specify connections in the form:  "host=my.db.host.example.org port=5678 dbname=dumb_db user=chewie"

Since those strings need to be kept around for the programs that are
directly using conninfo, it Sure Would Be Nice if those strings could
also be used as arguments to psql.

Peter Eisentraut observed that "-D" is not yet used; that's certainly
an option.

Thus, supposing we kept conninfo strings in a series of files in
/opt/scripts/conninfo, we might run a script via...

#!/bin/sh
CONNINFO=`cat /opt/scripts/conninfo/dumb_db.conninfo`
PERIOD='90 days'
QUERY="delete from my_table where trans_on < now() - '${PERIOD}'::interval;"
QUERY2="vacuum analyze my_table;"
psql -D "${CONNINFO}" -c "${QUERY}"
psql --pqconninfo="${CONNINFO}" -c "${QUERY2}"

I'm not sure those are forcibly the best names for options, but
they're a thought...
-- 
select 'cbbrowne' || '@' || 'gmail.com';
http://linuxdatabases.info/info/
Rules of the Evil Overlord #10.  "I will not interrogate my enemies in
the inner sanctum  -- a small hotel well outside  my borders will work
just as well." <http://www.eviloverlord.com/>


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Scan Keys
Следующее
От: "Diogo Biazus"
Дата:
Сообщение: xlog viewer prototype and new proposal