Re: Specifying psql password on command line - Mailing list pgsql-general

From Anand Raman
Subject Re: Specifying psql password on command line
Date
Msg-id 20010606101911.A2763@india-today.com
Whole thread Raw
In response to Specifying psql password on command line  ("Tauren Mills" <tauren@servlets.net>)
List pgsql-general
preety simple.. In ur shell script use

psql -h localhost ur_db -U ur_user_name <<EOF
ur_passwd
ur_sql_script.sql
EOF

is this is too much of a botheration u can set the environment variables
PGUSER and PGPASSWD

Hope this helps
Anand


On Tue, Jun 05, 2001 at 05:59:28PM -0700, Tauren Mills wrote:
>I've read the documentation for the psql commands as well as the createdb
>and dropdb commands.  It looks like there is no way to specify the password
>on the command line.  The password is always provided in the form of a stdin
>prompt.
>
>This makes it very difficult to use the commands from a shell script or a
>cron job.    The same with redirecting to/from a file or piping it
>somewhere.  It seems like there must be some way to specify the password on
>the command line.
>
>Am I missing something?  Any workarounds?
>
>Thanks,
>Tauren
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: Sequences in transaction context
Next
From: Igor
Date:
Subject: Re[2]: How to Alter tables with ARRAY? Help PLease