Re: SQL from shell script
От | Michael Fuhr |
---|---|
Тема | Re: SQL from shell script |
Дата | |
Msg-id | 20050114195703.GA19160@winnie.fuhr.org обсуждение исходный текст |
Ответ на | Re: SQL from shell script (Geoffrey <esoteric@3times25.net>) |
Список | pgsql-novice |
On Fri, Jan 14, 2005 at 02:32:48PM -0500, Geoffrey wrote: > echo "select * from table1; > select * from table2; > select * from table3; > "|psql rnd You could also use a here-document if your shell supports it (most do): psql rnd <<END_OF_SQL select * from table1; select * from table2; select * from table3; END_OF_SQL > Still, you'll have to deal with the password a different way likely. You could use the PGPASSWORD environment variable, although doing so is deprecated due to the security risk (many operating systems make environment variables visible to other processes). Another possibility would be to use ~/.pgpass; see "The Password File" in the libpq chapter of the documentation. Or, if the security model allows it, tweak pg_hba.conf so it doesn't require password authentication (some security can be maintaned by using ident authentication if the system supports it). -- Michael Fuhr http://www.fuhr.org/~mfuhr/
В списке pgsql-novice по дате отправления: