Thread: ADD COLUMN damage control

ADD COLUMN damage control

From
Diana Nemirovsky
Date:
I have a about 20 or 30 tables in a database. All was working fine, my
queries, my PHP front end. Then I did two things. First, I added columns
onto each table as follows. I am showing the commands for just one table,
but it was the same code for each table.

ALTER TABLE person ADD COLUMN record_created TIMESTAMP;
ALTER TABLE person ADD COLUMN record_created_by_user INT2;
ALTER TABLE person ADD COLUMN record_modified TIMESTAMP;
ALTER TABLE person ADD COLUMN record_modified_by_user INT2;

As you can see, there are no constraints or anything. Second, I added a
trigger on the person table.

Then site-wide, things all broke. I deleted (cascade) the trigger, but what
was breaking was across all tables, and not just on the tables touched by
my trigger. Queries that used to work fine no longer do. Not having any
other logical explanation, I looked up the VACUUM command, and tried that
on each table. Same result. Things are broken all over the place. Is there
something I need to do after adding columns to my tables? Or some other
thing that could explain what has happened? I'm at a loss.

Thanks for any help or pointers.



Diana Nemirovsky
Marin Consulting, Inc.
770 Menlo Ave, Ste 223
Menlo Park, CA 94025
v (650) 617-8699
f (650) 833-0790
http://www.marinconsulting.com




Re: ADD COLUMN damage control

From
Tom Lane
Date:
Diana Nemirovsky <diana@marinconsulting.com> writes:
> Then site-wide, things all broke. I deleted (cascade) the trigger, but what
> was breaking was across all tables, and not just on the tables touched by
> my trigger. Queries that used to work fine no longer do. Not having any
> other logical explanation, I looked up the VACUUM command, and tried that
> on each table. Same result. Things are broken all over the place.

No one can possibly help you with such a vague problem report.  Don't
say "broken", show us a few examples of specific queries and the exact
error messages you get.

            regards, tom lane