Replacing a table with constraints

From: "Mark Fenbers" <Mark(dot)Fenbers(at)noaa(dot)gov>
To: pgsql-sql(at)postgresql(dot)org
Subject: Replacing a table with constraints
Date: 2005-05-13 18:38:25
Message-ID: 4284F421.10809@noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table called Counties which partially contains a lot bad data. By" bad data", I mean some records are missing; some exist and shouldn't; and some records have fields with erroneous information. However, the majority of the data in the table is accurate. I have built/loaded a new table called newCounties with the same structure as Counties, but contains no bad data. My was to completely replace the contents of Counties with the contents of newCounties. The problem is: several other tables have Foreign Key constraints placed on Counties. Therefore, Pg will not let me 'DELETE FROM Counties;", nor will it let me "DROP TABLE Counties;"

I'm perplexed. Can someone suggest how I can best get data from Counties to look just like newCounties?

Mark

Attachment Content-Type Size
unknown_filename text/html 1.0 KB
Mark.Fenbers.vcf text/x-vcard 283 bytes

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ing. Jhon Carrillo 2005-05-13 18:49:38 Re: Replacing a table with constraints
Previous Message Greg Stark 2005-05-13 06:05:37 Re: interesting SQL puzzle - concatenating column with itself.