Re: Using the database to validate data - Mailing list pgsql-general

From Jeff Janes
Subject Re: Using the database to validate data
Date
Msg-id CAMkU=1yKiroBsgEjJHPjTsc4GLP13XtrXyy4gLu=For_JvHkZw@mail.gmail.com
Whole thread Raw
In response to Re: Using the database to validate data  (Zdeněk Bělehrádek<zdenek.belehradek@superhosting.cz>)
List pgsql-general
On Fri, Jul 24, 2015 at 5:17 AM, Zdeněk Bělehrádek <zdenek.belehradek@superhosting.cz> wrote:
What about creating a SAVEPOINT before each INSERT, and if the INSERT returns
an error, then ROLLBACK TO SAVEPOINT?

Make sure you release the savepoint if there was no error.  Otherwise you will quickly run out of memory.

Also, if there was an error, then after rolling back to the savepoint either release it, or refrain from starting a new one at the beginning of the next insert.

Cheers,

Jeff 

pgsql-general by date:

Previous
From: Chris Withers
Date:
Subject: pgbench tps drop from 5000 to 37 going from localhost to a server 13ms away
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Delete rule does not prevent truncate