Re: Postgres in bash-mode - Mailing list pgsql-hackers

From David Terrell
Subject Re: Postgres in bash-mode
Date
Msg-id 20020112003205.B18140@pianosa.catch22.org
Whole thread Raw
In response to Postgres in bash-mode  (Alexander Pucher <pucher@atlas.gis.univie.ac.at>)
Responses Re: Postgres in bash-mode  (Karl DeBisschop <kdebisschop@range.infoplease.com>)
List pgsql-hackers
On Thu, Jan 10, 2002 at 09:07:50AM +0100, Alexander Pucher wrote:
> Hi,
> 
> I hope, that this is not too off topic for this list, but anyway, it 
> should be easy for any PG-expert.
> 
> I need to run a shell script that logs in to Postgresql, executes a 
> query and logs off again.
> 
> In MySQL, I did it like this:
> 
> 'mysql -u user -ppassword < script.sh'
> 
> My problem is that I can't find a way to put the password in an 'psql' 
> statement at the prompt.
> 
> Any suggestions are welcome!

"Don't do that"

You CAN do something like 
% psql -f dbscript database
Password: <typeity>
<stuff happens>
129195981 INSERT
%

-- 
David Terrell            | "I went into Barnes and Noble to look for a 
Prime Minister, Nebcorp  | book on A.D.D., but I got bored and left." 
dbt@meat.net             | - Benjy Feen
http://wwn.nebcorp.com/  |


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: timestamptz + interval fixed
Next
From: Daniel Kalchev
Date:
Subject: Re: again on index usage