Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eydbh-0001Lp-Sd for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 13:16:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eydbg-0004o1-I9 for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 13:16:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eydbg-0004nr-6T for pgsql-general@lists.postgresql.org; Wed, 21 Mar 2018 13:16:44 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eydbZ-00051z-4U for pgsql-general@postgresql.org; Wed, 21 Mar 2018 13:16:42 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E61EA20BF1; Wed, 21 Mar 2018 09:16:35 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Wed, 21 Mar 2018 09:16:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=t0phul5Z4hbt1RHCwyNSRJ2PPyFK7 +2plF9xyj2jc48=; b=dMNU5OK82cY4GicrG6+caCV0FtzZRw6OuOlW1l4voo0D5 /xxoZgWA1GiaYIZ/fiod9RFA5ROoNgsRysTuEZ6OG5TzN4R+7lAJkKApX4yEsyv1 /lGTEFo2et+7ASmZdkdh4cNVqXH6/RZLIjl/EsZkKFdk2nbsL/CmrjrRgq7fkHzv JdyJ+DgtJe/2WngY+QqU/yZIcGI64LDqBxn/HH3Ji/H1nz5DtFSnIT6b+QtRoToG fVJ1wl3YD9EHzCRyHDpteQULVgvuk2aa9SzNK8SGBWVsRojQzSRiV2drq2swVszJ nPIQ4Etu4whLXMxhAvHFBaM75OtlIpLZYee7N3+Uw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=t0phul 5Z4hbt1RHCwyNSRJ2PPyFK7+2plF9xyj2jc48=; b=AFBfmJ4j+Y4M05jcxgs2IE hV0cXqn5iaHbJFwS050LvwCh9OSj2ZmOBZoCZ375wXR3UkqaapQysX8h7dZh1OWW oJdKrPJ6/pjzhrvZiokyOelXHfyDc/wCMuhVyG1Mg9CKf1/oxIPBgPqGvkFz6p1l jscVkQKxbeUalrfiXNCYeuHkbG7laCNZO1OFo+jg3xELFWrbZJOBZDtlFKRN1lWW 3u8zWQxX5OZdgW86UlGe/SYOvXURpixN+EZLaFobIOmL/gb5Uv3Yp7Bv/AwtO7zn xv9V/mJ7tX6gjirb/vFnLmDZFWfEmYRQBQPVz284Nr/4LJ3WNujKbw7b5hltt1JA == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 678297E0D6; Wed, 21 Mar 2018 09:16:35 -0400 (EDT) Subject: Re: Restore - disable triggers - when they fired? To: Durumdara Cc: Postgres General References: From: Adrian Klaver Message-ID: <8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com> Date: Wed, 21 Mar 2018 06:16:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/21/2018 02:41 AM, Durumdara wrote: > Dear Adrian! > > 2018-03-20 16:33 GMT+01:00 Adrian Klaver >: > > On 03/20/2018 07:56 AM, Durumdara wrote: > > > pg_dump --disable-triggers -d test -U aklaver -t > disable_trigger_test -a -f disable_trigger_test_data.sql > > > CREATE OR REPLACE FUNCTION public.trigger_test() > ... > truncate disable_trigger_test ; > > #Note I do this as a superuser. > psql -d test -U postgres -f disable_trigger_test_data.sql > > test=> select * from disable_trigger_test ; >  id | fld_1 > ----+------- >   1 | dog >   2 | cat > > > Thank you! Now I got it! > So the difference is: > > 1.) FULL DB restore into empty database creates the extra objects at the > end, so I do not need to worry about triggers. This also holds if you do a single(or multiple) table restore of both the table schema and data at the same time. > > 2.) Partial data restore into an existing database to existing tables > with triggers: this point I need to set "disable triggers" option. Well partial or complete data restore, anything that will trip the triggers on an existing table. > Very-very thank you! Glad it helped. > > dd -- Adrian Klaver adrian.klaver@aklaver.com