Re: Altering Column Date Types - Mailing list pgsql-novice

From Chris Boget
Subject Re: Altering Column Date Types
Date
Msg-id 022f01c2c625$0645ea10$8c01a8c0@ENTROPY
Whole thread Raw
In response to Re: Altering Column Date Types  (Aarni Ruuhimäki <aarni.ruuhimaki@kymi.com>)
List pgsql-novice
> I use 'pg_dump -c my_db > my_db_dump' and then edit the dump file's CREATE
> TABLE statements to change column data-tytes. When done, read or re-create
> the db back in with 'cat my_db_dump | psql my_db'
> Just make sure your data fits into the new data-type.

The only thing that may be problematic with this method is if the table being dumped
has some foreign key constraints on it from other tables.  So to add on to the above
steps, before you dump (or some time before you recreate the table), drop the other
constraints, do the above then recreate the other constraints.
Pain in the butt, yes, but unless you do this you won't be able to drop the table in
the first place.

Chris


pgsql-novice by date:

Previous
From: Antonio Scotti
Date:
Subject: Passing parameters to a Trigger
Next
From: Steve_Miller@sil.org
Date:
Subject: Re: collation