Re: [GENERAL] disable triggers using psql

2011-02-22 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 The saga continues. I've reverted to a multi-step process to try and figure this out. I create the initial database, then load it from the command line psql as follows: pro-# \set session_replication_role replic

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > The saga continues. I've reverted to a multi-step process to try and > figure this out. I create the initial database, then load it from the > command line psql as follows: > > pro-# \set session_replication_role replica; > pro-# \o db.ou

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I'm not sure how to address this. I'm not exactly sure where to place session_replication_role. It's very close to the top of the file: Is this a pg_dumpall? A \connect later on will reset the session_replicatio

Re: [GENERAL] disable triggers using psql

2011-02-21 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I'm not sure how to address this. I'm not exactly sure where to place session_replication_role. It's very close to the top of the file: Is this a pg_dumpall? A \connect later on will reset the session_replicatio

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 cut and paste: set ON_ERROR_ROLLBACK; Should be \set ON_ERROR_ROLLBACK on You can also set this when calling psql like so: psql --set ON_ERROR_ROLLBACK=on But that's getting off-topic now, as we've got the pro

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Chris Browne
li...@serioustechnology.com (Geoffrey Myers) writes: > Greg Sabino Mullane wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: RIPEMD160 >> >> >>> cut and paste: >>> >>> set ON_ERROR_ROLLBACK; >> >> Should be >> >> \set ON_ERROR_ROLLBACK on >> >> You can also set this when calling psql like so: >

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I'm not sure how to address this. I'm not exactly sure where to place > session_replication_role. It's very close to the top of the file: Is this a pg_dumpall? A \connect later on will reset the session_replication_role. If so, add the SE

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 cut and paste: set ON_ERROR_ROLLBACK; Should be \set ON_ERROR_ROLLBACK on You can also set this when calling psql like so: psql --set ON_ERROR_ROLLBACK=on But that's getting off-topic now, as we've got the pro

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > cut and paste: > > set ON_ERROR_ROLLBACK; Should be \set ON_ERROR_ROLLBACK on You can also set this when calling psql like so: psql --set ON_ERROR_ROLLBACK=on But that's getting off-topic now, as we've got the problem narrowed: > INSERT

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 So I added the on_error_rollback to the script and I get this: ... psql:test.sql:12: ERROR: current transaction is aborted, commands ignored until end of transaction block That isn't right: are you sure you said

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > So I added the on_error_rollback to the script and I get this: ... > psql:test.sql:12: ERROR: current transaction is aborted, commands > ignored until end of transaction block That isn't right: are you sure you said ON_ERROR_ROLLBACK? It's

Re: [GENERAL] disable triggers using psql

2011-02-18 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 psql:test.sql:11: ERROR: current transaction is aborted, commands ignored until end of transaction block Oops my bad, I forgot to tell you I have \set ON_ERROR_ROLLBACK on in my .psqlrc. So you'll need to add tha

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 set local session_replication_role = replica; But that does not seem provide the expected relief. How exactly did this fail? This should absolutely disable all triggers for you, unless you've mucked with the trigge

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I thought we had tried this before, but with an embedded BEGIN. I get the same result, although I used the -1 switch instead of the BEGIN/COMMIT: psql:backup.txt:2077303: ERROR: insert or update on table "custome

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > psql:test.sql:11: ERROR: current transaction is aborted, commands > ignored until end of transaction block Oops my bad, I forgot to tell you I have \set ON_ERROR_ROLLBACK on in my .psqlrc. So you'll need to add that to the top of the scri

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I thought we had tried this before, but with an embedded BEGIN. I get the same result, although I used the -1 switch instead of the BEGIN/COMMIT: psql:backup.txt:2077303: ERROR: insert or update on table "custome

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I thought we had tried this before, but with an embedded BEGIN. I get > the same result, although I used the -1 switch instead of the BEGIN/COMMIT: > > psql:backup.txt:2077303: ERROR: insert or update on table "customer" > violates foreign

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 set local session_replication_role = replica; But that does not seem provide the expected relief. How exactly did this fail? This should absolutely disable all triggers for you, unless you've mucked with the trigge

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 >>> set local session_replication_role = replica; >>> >>> But that does not seem provide the expected relief. >> >> How exactly did this fail? This should absolutely disable all >> triggers for you, unless you've mucked with the triggers >> a

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Greg Sabino Mullane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 We were trying to accomplish this without having to hack the dump to much. We attempted adding: set local session_replication_role = replica; But that does not seem provide the expected relief. How exactly did

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > We were trying to accomplish this without having to hack the dump to > much. We attempted adding: > > set local session_replication_role = replica; > > But that does not seem provide the expected relief. How exactly did this fail? This sho

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread John DeSoi
On Feb 17, 2011, at 6:59 AM, Geoffrey Myers wrote: >> Unless something very big changed when I wasn't looking, the >> constraints are actually implemented as triggers under the hood. But >> you're right that it'd be cleaner to drop the constraints and re-add >> them than to fool with system trig

Re: [GENERAL] disable triggers using psql

2011-02-17 Thread Geoffrey Myers
Andrew Sullivan wrote: On Wed, Feb 16, 2011 at 10:08:53AM -0500, David Johnston wrote: I may be off-track here but triggers do not enforce referential integrity - constraints do. If you need to disable triggers you can do so via the ALTER TABLE command. Unless something very big changed when

Re: [GENERAL] disable triggers using psql

2011-02-16 Thread Andrew Sullivan
On Wed, Feb 16, 2011 at 10:08:53AM -0500, David Johnston wrote: > I may be off-track here but triggers do not enforce referential integrity - > constraints do. If you need to disable triggers you can do so via the ALTER > TABLE command. Unless something very big changed when I wasn't looking, the

Re: [GENERAL] disable triggers using psql

2011-02-16 Thread David Johnston
...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Geoffrey Myers Sent: Wednesday, February 16, 2011 9:51 AM To: pgsql-general Subject: [GENERAL] disable triggers using psql So, we have a text dump that we used to clean up our data, now we need to reload it into the new database

Re: [GENERAL] disable triggers using psql

2011-02-16 Thread Andrew Sullivan
On Wed, Feb 16, 2011 at 09:50:39AM -0500, Geoffrey Myers wrote: > Is there a way to resolve this issue with the psql loading approach? You can just disable or, depending on your version of Postgres, drop the triggers at the start of the load, load everything up, and then add them again. A -- An

[GENERAL] disable triggers using psql

2011-02-16 Thread Geoffrey Myers
So, we have a text dump that we used to clean up our data, now we need to reload it into the new database. Problem is, we have some data integrity issues that cause records to fail to load. Before we ran into the data conversion issue we were using 'pg_restore disable_triggers' to get around