ALTER TABLE ADD COLUMN

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-hackers(at)hub(dot)org
Subject: ALTER TABLE ADD COLUMN
Date: 1999-06-01 11:10:17
Message-ID: 3753BF99.9C23F094@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi guys. I was trying to add a column to a class again. The class is low
down in an inheritance hierarchy.

This time, I remembered to add the * after the table name, so I thought
that I was ok. Everything seemed ok, and the database went on working as
expected for ages.

Then one day I had to restore my database and I found again that pg_dump
doesn't work with
ERROR: pg_atoi: error in "1999-05-10 16:27:40+10": can't parse "-05-10
16:27:40+10"

because I think it dumps columns in the wrong order.

Fortunately I was able to restore the database by abandoning that column
and removing it from the table definition. Fortunately I didn't have
much data in that column that was too much loss to lose (yet).

I know I mentioned this problem before, but I thought it was because I
had forgotten the "*" on the ALTER TABLE ADD COLUMN statement. Now I
realise that even when you remember it, you can be bitten. Worse, you
can be bitten much later after you've forgotten what was the cause.

I'm not sure what to do now. I really do need to add that extra column.
If I thought really really hard, I might be able to figure out how to do
it with Perl, re-arrangement of columns etc. But I've got a lot of
tables and it sounds all too hard. The frustrating thing is that adding
the columns actually works. It's just that it can't be restored properly
after a catastrophy.

--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Bitmead 1999-06-01 11:13:13 pg_dump
Previous Message Vadim Mikheev 1999-06-01 09:39:15 LOCKTAG updated -> gmake clean is required