Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading - Mailing list pgsql-bugs

From Hartmut Goebel
Subject Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading
Date
Msg-id 4C08BD8C.60609@goebel-consult.de
Whole thread Raw
In response to Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Am 03.06.2010 20:07, schrieb Tom Lane:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>> Hartmut Goebel <h.goebel@goebel-consult.de> wrote:
>>> If upgraded the rpm-packages from 8.3 to 8.4. Then postgres failed
>>> starting (something like "Database version mismatch").
>=20=20
>> You need to be running the old server using 8.3 software and while
>> using pg_dump from 8.4 software.  Does your packager provide some
>> way to install the new version at a different location?  If not, is
>> there a separate machine on which you could install 8.4?
>=20
> In practice, if he has to redo the dump, the easiest fix is really
> going to be to rename the column beforehand.  He's likely to end up
> doing that anyway rather than quoting its name forever ...

Both solutions are quite complicated and require a lot of work and
knowledge. Esp. since there seams to be no upgrade or migration guide
available.

(NB: I personally solved the problem using pg_restore | sed | pqsl. But
this bug realy is about a generic problem.)

Given the fact that postgres is not only used in "high end" environments
which have a professional database admin (see below), I strongly suggest
finding a solution which is easier to handle for average admins.

The solution I suggested (simply quoting all column names) would AFAIK
solve this problem once and forever.

An example for Postgresql in a non-database-admin evironment is the
three tier ERP application www.tryton.org. The Tryton admin typically is
not a database guy, but a generic, average server administrator. He
probably knowns about databases, SQL, etc. But he has *a lot* of work
and he is happy about everything which makes his live easier. And he
hates stuff which does not work, while it is commonly expected to work easy.

The Tryton GUI offers backing up the database, which is simply pg_dump
behind. The Tryton admin expects to be able to restore this backup after
upgrade. Because it is such easy to get a database backup, he expects
restore being that easy, too.

The Tryton admin does not understand at first, why this doe not work. It
worked when upgrading 8.1 to 8.2 and when upgrading 8.2 to 8.3. But when
upgrading to 8.4 it does not work.

If the admin is a Mysql-fan, he will be curing on postgres, as soon as
he found out how easy the solution would have been: "Would I have
stayied at mysql, they are able to quote all column names if neccessary.
Sh** postgres!"

And he will be wasting another hour (or more) working around the
problem. While the solution could be *so easy*: simply quote all column
names in pg_dump. (And backport to 8.0, 8.2, 8.3 :-)

--=20
Sch=C3=B6nen Gru=C3=9F - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist f=C3=BCr IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult mit Mitglied bei http://www.7-it.de

pgsql-bugs by date:

Previous
From: Hartmut Goebel
Date:
Subject: Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading
Next
From: Stephen Frost
Date:
Subject: Re: BUG #5488: pg_dump does not quote column names -> pg_restore may fail when upgrading