psql in 7.2devel loops

From: John Summerfield <pgtest(at)ami(dot)com(dot)au>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: psql in 7.2devel loops
Date: 2002-01-26 11:13:15
Message-ID: Pine.LNX.4.33.0201261905040.27635-100000@numbat.Os2.Ami.Com.Au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


It used to be the case that psql could be run thus:

psql -U summer -h numbat template1 <<ZZ
password
<commands>
ZZ

which is very convenient in scripting.

Now, it writes a password prompt (successfully in my case) and tries to
read the password (presumably from the tty) which fails.

Here is the entire script that fails for me:

#!/bin/bash
set -x
psql -U summer -h $HOSTNAME template1 <<zz
thisisnotthepassword
--\h create
drop DATABASE sharetrader;
CREATE DATABASE sharetrader;
zz

I ran this script from my console:
#!/bin/bash
(
exec </dev/null
(
(
cat <<zz
to: $USER(at)$HOSTNAME
cc: summer(at)$HOSTNAME
subject: postgresql build and test run `date`

zz
set -x
time pg.build
time pg.setupdb
pg.ss start
time pg.test
pg.ss stop
) 2>&1) \
| /usr/sbin/sendmail -t &
)

Presumably opening the tty worked - there is stil a terminal associated
with the script.

The environment is Red Hat Linux 7.2, 2.4.17 kernel.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michaele Holtman 2002-01-26 13:36:46 initdb problems
Previous Message Chris Humphries 2002-01-25 16:29:17 no data for locks