Re: psql without password

Lists: pgsql-novice
From: "Retzlaw Heinrich" <hretzlaw(at)etm-ag(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: psql without password
Date: 2003-05-22 13:03:31
Message-ID: 03May22.150548cest.117147@fwetm.etm-ag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hello,
I have the following command in a script:
ROOMID=`echo "$USER_PW" | psql -c "select nextval('contract_roomid_seq');"
"$DB_NAME" "$DB_USER" | awk -F" " '{if ($1 > 0 && $1 < 3000000000) print
$1}'`
Now I have the next valid roomid in the variable ROOMID.

With the psql-version 7.1.0 it works fine. But with psql-version 7.2.1 I
have to type the password again.
I have several of this commands. So I have to type the password several
times.
What can I do to give the password in one command-line?

Best regards
Heinrich

Heinrich Retzlaw - Software Developer
ETM Deutschland GmbH
Adenauerstraße 20-A1, D-52146 Aachen
Tel. +49/2405/483-0, Fax -707
E-Mail: hretzlaw(at)etm(dot)at
Web: http://www.etm.at http://www.praedico.com

Attachment Content-Type Size
winmail.dat application/ms-tnef 1.7 KB

From: nolan(at)celery(dot)tssi(dot)com
To: hretzlaw(at)etm-ag(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: psql without password
Date: 2003-05-25 16:41:09
Message-ID: 20030525164110.21295.qmail@celery.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

> With the psql-version 7.1.0 it works fine. But with psql-version 7.2.1 I
> have to type the password again.
> I have several of this commands. So I have to type the password several
> times.
> What can I do to give the password in one command-line?

Move up to 7.3 and use the .pgpass feature to bypass the password check.
--
Mike Nolan


From: "A(dot)Bhuvaneswaran" <bhuvan(at)symonds(dot)net>
To: Retzlaw Heinrich <hretzlaw(at)etm-ag(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: psql without password
Date: 2003-05-26 05:06:41
Message-ID: Pine.LNX.4.44.0305261035050.1254-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

> With the psql-version 7.1.0 it works fine. But with psql-version 7.2.1 I
> have to type the password again.
> I have several of this commands. So I have to type the password several
> times.
> What can I do to give the password in one command-line?

There are more than one ways (2 ways) to achieve this -:). Try any one of
the below:

1. Set the authetication method to trust in pg_hba.conf
2. Set PGPASSWORD environment variable

regards,
bhuvaneswaran