LEFT JOIN in pg_dumpall is a bug

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: LEFT JOIN in pg_dumpall is a bug
Date: 2001-01-23 21:22:22
Message-ID: Pine.LNX.4.30.0101232214060.788-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH; do

(line breaks messed up)

won't actually work if there indeed happens to be a database without a
valid owner, because the 'read' command will take ENCODING as the dba
name.

I guess the real question is, what should be done in this case? I think
it might be better to error out and let the user fix his database before
backing it up.

(At a glance, I think pg_dump also has some problems with these sort of
constellations.)

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-01-23 21:53:53 Re: Re: AW: Re: MySQL and BerkleyDB (fwd)
Previous Message Tom Lane 2001-01-23 21:17:50 Re: "initdb -t" destroys all databases