Re: help! - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: help!
Date
Msg-id 3FB97D04.1080509@familyhealth.com.au
Whole thread Raw
In response to help!  (Larry Rosenman <ler@lerctr.org>)
Responses Re: help!
List pgsql-hackers
Wait for confirmation from at least one other developer perhaps, buy you 
can try this:

1. Set attisdropped to false for the attribute

2. Set the atttypid back to whatever the oid of the type of that column 
is/was   (Compare to an undropped similar column)

3. Use ALTER TABLE/SET NOT NULL on the column if it was originally NOT NULL

4. Set attstattarget to -1 to re-enable stat gathering

5. Rename the column (attname field) back to whatever it was.

6. Re set the default on the column

7. Done. (I think)

By the way, vacuuming doesn't necessarily have much to do with it - 
updating rows does though.  I'm not 100% sure what will happen exactly 
when you follow the steps above (reversing what's in RemoveAttributeById).

Chris

Larry Rosenman wrote:

> I screwed up, and dropped a column when I shouldn't have.
> 
> I have *not* vacuumed this DB yet.
> 
> Is there any catalog mucking I can do to bring it back?
> 
> LER
> 
> 



pgsql-hackers by date:

Previous
From: Larry Rosenman
Date:
Subject: Re: help!
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Release cycle length