pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Iñigo Martinez Lasala <imartinez@vectorsf.com>
To: Josh Kupershmidt <schmiddy@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Disabling triggers with psql (gforge 7.4 to 8.2 migration)
Date: Wed, 10 Feb 2010 16:30:07 +0100
Message-ID: <1265815807.6369.19.camel@coyote> (raw)
In-Reply-To: <971254BD-6919-41BB-8D26-160C14D5BFE2@gmail.com>
References: <99024f5f1002071922j5b14c350mb1612313690f16ec@mail.gmail.com>
	<87k4umg0c3.fsf@hi-media-techno.com>
	<1265794218.3714.12.camel@coyote>
	<971254BD-6919-41BB-8D26-160C14D5BFE2@gmail.com>

Hmmmm...

What about 
UPDATE pg_trigger SET tgenabled = false;

Restore data, and after done:
UPDATE pg_trigger SET tgenabled = true;

I'm going to test it.

-----Original Message-----
From: Josh Kupershmidt <schmiddy@gmail.com>
To: Iñigo Martinez Lasala <imartinez@vectorsf.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: [ADMIN] Disabling triggers with psql (gforge 7.4 to 8.2
migration)
Date: Wed, 10 Feb 2010 09:55:15 -0500


On Feb 10, 2010, at 4:30 AM, Iñigo Martinez Lasala wrote:
> 
> 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=p ...
 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

view thread (11+ messages)  latest in thread

Message-ID: <1265815807.6369.19.camel@coyote>
Permalink:  ../1265815807.6369.19.camel@coyote/
Also on:    postgresql.org/message-id/1265815807.6369.19.camel@coyote

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: imartinez@vectorsf.com, schmiddy@gmail.com
  Subject: Re: Disabling triggers with psql (gforge 7.4 to 8.2 migration)
  In-Reply-To: <1265815807.6369.19.camel@coyote>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox