Re: Altering Column Date Types

From: "Chris Boget" <chris(at)wild(dot)net>
To: <aarni(dot)ruuhimaki(at)kymi(dot)com>, "Desmond Coughlan" <psql(at)zeouane(dot)org>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Altering Column Date Types
Date: 2003-01-27 16:56:13
Message-ID: 022f01c2c625$0645ea10$8c01a8c0@ENTROPY
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Steve_Miller 2003-01-27 17:29:25 Re: collation
Previous Message Antonio Scotti 2003-01-27 15:29:59 Passing parameters to a Trigger