Tom Lane writes:
$PSQL -d template1 -At -F ' ' \
-c "SELECT datname, usename, pg_encoding_to_char(d.encoding),
datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba
= usesysid) WHERE datallowconn;" | \
while read DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH; do
Peter Eisentraut [EMAIL PROTECTED] writes:
Is there a more robust way of reading the data into the script?
Provided that 'cut' is portable, then this works for me:
My old copy of Horton's _Portable C Software_ says that cut(1) is a
SysV-ism adopted by POSIX. At that time (1990) it wasn't
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
Peter Eisentraut [EMAIL PROTECTED] writes:
I'm not sure whether this is actually an overall improvement. I'm tempted
to just coalesce(usename, {some default user}) instead.
I thought about that to begin with, but figured you wouldn't like it ;-)
regards, tom lane
Peter Eisentraut [EMAIL PROTECTED] writes:
This snippet in pg_dumpall
$PSQL -d template1 -At -F ' ' \
-c "SELECT datname, usename, pg_encoding_to_char(d.encoding),
datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba
= usesysid) WHERE datallowconn;" | \
while read