On Sat, Feb 20, 2016 at 11:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Bill Moran <wmoran@potentialtech.com> writes: > On Sat, 20 Feb 2016 16:29:09 +0000 > Vitalii Tymchyshyn <vit@tym.im> wrote: >> Well, I suppose replacing simple copy with procedural per-row function >> would give huge performance hit. Also what method do you propose to use in >> the code? Savepoints?
> Not at all. PL/PGSQL's ON ERROR handling can manage this without needing > savepoints.
Actually, plpgsql's exception blocks *are* savepoints under the hood. The backend engine does not have any way of recovering from errors other than a (sub)transaction abort, which means you can't do this without a savepoint or equivalent.