Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9D44F634249 for ; Wed, 10 Feb 2010 11:01:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 39209-01-9 for ; Wed, 10 Feb 2010 15:01:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.190]) by mail.postgresql.org (Postfix) with ESMTP id 3A078633222 for ; Wed, 10 Feb 2010 10:55:23 -0400 (AST) Received: by gv-out-0910.google.com with SMTP id n8so12082gve.7 for ; Wed, 10 Feb 2010 06:55:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:message-id:references:to :x-mailer; bh=V5Cl48LUfEV/n83cSfjlqeuEzfLCtKPYr+W9ctCdWfE=; b=iPmgMglPIZcFjoWc57Vciph5L7rhpATAvHkCsUS/XQv/Yg61jedIYzqUfkvePFWitP mTATKYl0ugs9C+uHjb+w8xqv4gtB7FdJMSSqaa5mA3+gLX53hGt1P7Xi1RTr7G8ksIsS e5K6eFr07GvYZuhOILu0OLVusp7gJq5mMD8OQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; b=iXciU2P/yWNY+nj+IlpsuNgCGGDgepspzr3o3vix0x1Ua3hEQV95aOp4TzNoX3ei0i GIjWN/Q/dEEMYaH1S+Wp4mQ4KU8LL+nAdnRfRroHDk3oCgCyRCLAG2aBUWfL4ywKAWWW 879rKr+XBSwN+6HAOtqLTbRT78WBje/1KXyjI= Received: by 10.102.17.15 with SMTP id 15mr243265muq.133.1265813720557; Wed, 10 Feb 2010 06:55:20 -0800 (PST) Received: from ?172.19.105.147? (static-72-85-255-114.bstnma.east.verizon.net [72.85.255.114]) by mx.google.com with ESMTPS id j2sm7145082mue.32.2010.02.10.06.55.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Feb 2010 06:55:19 -0800 (PST) Subject: Re: Disabling triggers with psql (gforge 7.4 to 8.2 migration) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: multipart/alternative; boundary=Apple-Mail-14--256293142 From: Josh Kupershmidt In-Reply-To: <1265794218.3714.12.camel@coyote> Date: Wed, 10 Feb 2010 09:55:15 -0500 Cc: pgsql-admin Message-Id: <971254BD-6919-41BB-8D26-160C14D5BFE2@gmail.com> References: <99024f5f1002071922j5b14c350mb1612313690f16ec@mail.gmail.com> <87k4umg0c3.fsf@hi-media-techno.com> <1265794218.3714.12.camel@coyote> To: =?iso-8859-1?Q?I=F1igo_Martinez_Lasala?= X-Mailer: Apple Mail (2.1077) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201002/77 X-Sequence-Number: 33680 --Apple-Mail-14--256293142 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On Feb 10, 2010, at 4:30 AM, I=F1igo Martinez Lasala wrote: >=20 > Third one, and we haven't been able to fix it, is we cannot restore = data dump via psql due to psql does not have an option to disable = triggers. So, when restoring data, it fails. So... is there any way to = disable in a psql session all triggers same way like with pg_restore = --disable-triggers? Or can we convert plain text dump to be processed = by pg_restore? Perhaps a table by table trigger disabling script? How about: 1. restore your schema, with triggers, using a pg_dump --schema-only = ... ; pg_restore ...=20 2. Create a psql-loadable data-only dump using pg_dump --data-only = --disable-triggers --format=3Dp ... 3. clean the data-only dump and restore Or, you could do a full pg_dump -Fc ... of your database, then use = pg_restore to restore the compressed dumpfile into a plaintext file = (i.e. pg_restore [options] filename). Then run your cleanup on the = plaintext file, and reload.=20 Josh= --Apple-Mail-14--256293142 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1

Third one, and we haven't been able to fix it, is we cannot restore data = dump via psql due to psql does not have an option to disable triggers. = So, when restoring data, it fails. So... is there any way to disable in = a psql session all triggers same way like with pg_restore = --disable-triggers?  Or can we convert plain text dump to be = processed by pg_restore? Perhaps a table by table trigger disabling = script?

How = about:
 1. restore your schema, with triggers, using a = pg_dump --schema-only ... ; pg_restore ... 
 2. = Create a psql-loadable data-only dump using pg_dump --data-only = --disable-triggers --format=3Dp ...
 3. clean the = data-only dump and restore

Or, you could do a = full pg_dump -Fc ... of your database, then use pg_restore to restore = the compressed dumpfile into a plaintext file (i.e. pg_restore [options] = filename). Then run your cleanup on the plaintext file, and = reload. 

Josh
= --Apple-Mail-14--256293142--