Re: LEFT JOIN in pg_dumpall is a bug - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: LEFT JOIN in pg_dumpall is a bug
Date
Msg-id Pine.LNX.4.30.0101242233130.1469-100000@peter.localdomain
Whole thread Raw
In response to Re: LEFT JOIN in pg_dumpall is a bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LEFT JOIN in pg_dumpall is a bug
List pgsql-hackers
Tom Lane writes:

> If you think depending on POSIX utilities is OK, then use cut.
> I'd recommend sed, though.

This has gotten pretty silly:

TAB='   ' # tab here

$PSQL -d template1 -At -F "$TAB" \ -c "SELECT datname, usename, pg_encoding_to_char(d.encoding),
datistemplate, datpath, 'x' FROM pg_database d LEFT JOIN pg_shadow u ON
(datdba = usesysid) WHERE datallowconn;" | \
while read RECORDS; do   DATABASE=`echo "x$RECORDS" | sed "s/^x\([^$TAB]*\).*/\1/"`   DBOWNER=`echo "x$RECORDS" | sed
"s/^x[^$TAB]*$TAB\([^$TAB]*\).*/\1/"`  ENCODING=`echo "x$RECORDS" | sed
"s/^x[^$TAB]*$TAB[^$TAB]*$TAB\([^$TAB]*\).*/\1/"`  ISTEMPLATE=`echo "x$RECORDS" | sed
"s/^x[^$TAB]*$TAB[^$TAB]*$TAB[^$TAB]*$TAB\([^$TAB]*\).*/\1/"`  DBPATH=`echo "x$RECORDS" | sed
"s/^x[^$TAB]*$TAB[^$TAB]*$TAB[^$TAB]*$TAB[^$TAB]*$TAB\([^$TAB]*\).*/\1/"`

I'm not sure whether this is actually an overall improvement.  I'm tempted
to just coalesce(usename, {some default user}) instead.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: "Mikheev, Vadim"
Date:
Subject: RE: WAL documentation
Next
From: "Oliver Elphick"
Date:
Subject: Re: Re: [GENERAL] child table doesn't inherit PRIMARY KEY?