Thread: Re: [GENERAL] psql -l gives bad output

Re: [GENERAL] psql -l gives bad output

From
Ron Snyder
Date:
> >
> > But I recall a number of rounds of bug-fixes concerning quoting in
> > the pgsql shell scripts, so I'd not be surprised in the
> least to hear
> > that pre-7.2 PG releases get this wrong.  Or for that
> matter, we might
> > still have some problems in this line on some platforms with oddball
> > shells.  If you find that dropdb messes up with weird names in 7.2,
> > please send details about the test case and your platform...


RH 7.2; Postgres 7.2.1

bash-2.05$ BLAH='ab
> cd'
bash-2.05$ echo $BLAH
ab cd
bash-2.05$ echo "$BLAH"
ab
cd

[root@vault bin]# diff -c dropdb.orig dropdb
*** dropdb.orig Tue May 21 22:40:33 2002
--- dropdb      Tue May 21 22:40:46 2002
***************
*** 131,137 ****
  fi


! dbname=`echo $dbname | sed 's/\"/\\\"/g'`

  ${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
  if [ "$?" -ne 0 ]; then
--- 131,137 ----
  fi


! dbname=`echo "$dbname" | sed 's/\"/\\\"/g'`

  ${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
  if [ "$?" -ne 0 ]; then