X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E071E53347 for ; Fri, 13 May 2005 15:50:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99519-04 for ; Fri, 13 May 2005 18:50:46 +0000 (GMT) Received: from rs25s9.datacenter.cha.cantv.net (rs25s9.datacenter.cha.cantv.net [200.44.33.10]) by svr1.postgresql.org (Postfix) with ESMTP id D396553238 for ; Fri, 13 May 2005 15:50:45 -0300 (ADT) Received: from tgusta2 (dC85A71E0.dslam-21-1-18-10-2-02.fsl.dsl.cantv.net [200.90.113.224]) by rs25s9.datacenter.cha.cantv.net (8.13.0/8.13.0/3.0) with SMTP id j4DInKpr012482; Fri, 13 May 2005 14:50:08 -0400 X-Matched-Lists: [] Message-ID: <01c301c557ec$9983b090$1400a8c0@tgusta2> Reply-To: "Ing. Jhon Carrillo" From: "Ing. Jhon Carrillo" To: "Mark Fenbers" , References: <4284F421.10809@noaa.gov> Subject: Re: Replacing a table with constraints Date: Fri, 13 May 2005 14:49:38 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01C0_01C557CA.FD041280" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: ClamAV version 0.84, clamav-milter version 0.84e on rs25s9.datacenter.cha.cantv.net X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.264 tagged_above=0 required=5 tests=AWL, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200505/99 X-Sequence-Number: 21412 This is a multi-part message in MIME format. ------=_NextPart_000_01C0_01C557CA.FD041280 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Use Drop table YOUR_TABLE cascade Jhon Carrillo Ingeniero en Computaci=F3n Caracas - Venezuela ----- Original Message -----=20 From: Mark Fenbers=20 To: pgsql-sql@postgresql.org=20 Sent: Friday, May 13, 2005 2:38 PM Subject: [SQL] Replacing a table with constraints 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;" =20 I'm perplexed. Can someone suggest how I can best get data from = Counties to look just like newCounties? Mark -------------------------------------------------------------------------= ----- ---------------------------(end of = broadcast)--------------------------- TIP 8: explain analyze is your friend ------=_NextPart_000_01C0_01C557CA.FD041280 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Use          Drop = table=20 YOUR_TABLE cascade
 
Jhon Carrillo
Ingeniero en=20 Computaci=F3n
Caracas - = Venezuela
 
 
----- Original Message -----
From:=20 Mark=20 Fenbers
Sent: Friday, May 13, 2005 2:38 = PM
Subject: [SQL] Replacing a = table with=20 constraints

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

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

Mark



---------------------------(end of=20 broadcast)---------------------------
TIP 8: explain analyze is = your=20 friend
------=_NextPart_000_01C0_01C557CA.FD041280--