Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B8E6C9FB403 for ; Wed, 4 Oct 2006 11:56:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 58028-05 for ; Wed, 4 Oct 2006 11:55:53 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id 846FD9FB373 for ; Wed, 4 Oct 2006 11:55:52 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so299705pyd for ; Wed, 04 Oct 2006 07:55:50 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=WjZj5885+4s0fsQdXizx6MGPfYl/3wpUNWKoqunfmXXM8dXMUz3F4LKQrhZIX/fSzzw+vq4F4Wdsn0T9j+LbnF2d7ZEAMUpdz1hHFTj9bwBNBCnxN8E+VGAZcgaRlqsi+b8iDBZ2Cwq7XHe/lQgtwqFZtJw+DjAseW0O6Eonu48= Received: by 10.35.96.11 with SMTP id y11mr1383316pyl; Wed, 04 Oct 2006 07:55:50 -0700 (PDT) Received: by 10.35.78.6 with HTTP; Wed, 4 Oct 2006 07:55:49 -0700 (PDT) Message-ID: Date: Wed, 4 Oct 2006 09:55:49 -0500 From: "Aaron Bono" To: "Ezequias Rodrigues da Rocha" Subject: Re: [SQL] How to overwrite a table [only data]? Cc: "pgAdmin Support" , pgsql-sql@postgresql.org In-Reply-To: <55c095e90610040440v431e15a3m34fa72ef19c239e8@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13567_30620315.1159973749968" References: <55c095e90610040440v431e15a3m34fa72ef19c239e8@mail.gmail.com> X-Google-Sender-Auth: 3385070602a7847d X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.509 tagged_above=0 required=5 tests=AWL, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/13 X-Sequence-Number: 5850 ------=_Part_13567_30620315.1159973749968 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Ezequias Rodrigues da Rocha wrote: > > Hi list, > > I would like to overwrite a table with problem with his original. But > there are some points. > > I can't just delete and restore it becouse it has a foreign key and when I > try to delete it ask for drop cascade. > > As I know the drop cascade delete in both tables the rows related. Is it > correct ? You can drop the foreign keys and then the table. Then when you recreate and repopulate the table, you can add the foreign keys back at the very end. ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_13567_30620315.1159973749968 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/4/06, Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com> wrote:
Hi list,

I would like to overwrite a table with problem with his original. But there are some points.

I can't just delete and restore it becouse it has a foreign key and when I try to delete it ask for drop cascade.

As I know the drop cascade delete in both tables the rows related. Is it correct ?

You can drop the foreign keys and then the table.  Then when you recreate and repopulate the table, you can add the foreign keys back at the very end.


==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_13567_30620315.1159973749968--