pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@potentialtech.com>
To: Vitalii Tymchyshyn <vit@tym.im>
Cc: Craig Ringer <craig@2ndquadrant.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: John R Pierce <pierce@hogranch.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: JDBC behaviour
Date: Sat, 20 Feb 2016 12:09:01 -0500
Message-ID: <20160220120901.58bea0d780fad45775f04bfa@potentialtech.com> (raw)
In-Reply-To: <CABWW-d3dDrDQbKA1uh5o3XzFcLrzc7QtHkRsxSdrznUUD=Vq6Q@mail.gmail.com>
References: <VisenaEmail.10e.692062643617cb13.152f4695802@tc7-visena>
	<954cc530fdaf2c5cf63dcb180d05fb56@imap.procolix.com>
	<CAGuFTBXSwk2UmFs_b0wYuTv_BFtLwVmco1mgT5OSb+dwX-U+Sw@mail.gmail.com>
	<4C508581-9CA3-490D-A376-CC1F9FF5D258@me.com>
	<CAGuFTBW_xcn5nWtggiwq46f=6Rc5TYEqwtmiWEEGGfB+PSLbUg@mail.gmail.com>
	<CAMsr+YH3NHZ__xSxWfVH4neGa6w8nLRuLLRG8kqXt9bgE1eEBA@mail.gmail.com>
	<56C8487F.7020406@hogranch.com>
	<CAMsr+YF6nj0Qh+A0J3hJrQD1ofwq_=k_tXUewb0EQO_0uj7Azg@mail.gmail.com>
	<CAKFQuwbo6QZ7dae91mPcnXJyija4EfDX4=F_ULta2hXf4XwbEw@mail.gmail.com>
	<CABWW-d3Mu=vto2ML22Q+iQe-znNkQLyyew_FJmZn086oBLiqKA@mail.gmail.com>
	<20160220111625.4ee764661333e42e230348ad@potentialtech.com>
	<CABWW-d3dDrDQbKA1uh5o3XzFcLrzc7QtHkRsxSdrznUUD=Vq6Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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.

> I'd say this would also add a more slowdown.

What? The savepoints? Well, you don't need them. The stored
procedure is going to incur a bit of a hit, though.

> Also quite a bit of boilerplate code would be needed. It's similar to merge
> statement. Yes, it can be achieved in pure SQL, but having clean merge
> statement saves you a lot of headache and is usually much more efficient.
> Basically, it's not that what OP needs is not doable at all, it's that
> other RDBMs often has this functionality in much more convenient and
> performance optimized way.

True. I don't think "clean up my crappy data" has ever been a
priority for PostgreSQL. Although, "allow the user to build whatever
is needed" has been.

I find it curious that those of us who become stewards of other people's
data find ourselves bending over backwards to try to clean up their
garbage data. It's an interesting social commentary on how software
design has changed since the term GIGO was in common use.

> Best regards, Vitalii Tymchyshyn
> 
> ??, 20 ???. 2016 11:16 Bill Moran <wmoran@potentialtech.com> ????:
> 
> > On Sat, 20 Feb 2016 16:01:04 +0000
> > Vitalii Tymchyshyn <vit@tym.im> wrote:
> >
> > > Well, it OT here and belongs to -hackers, but as for me main use case
> > here
> > > is ETL or ELT process getting a lot of unvalidated external data.
> > > And a good option to solve this problem is not to change transaction
> > > semantics or slow down processing by adding tons of savepoints, but add
> > "on
> > > error" clause to insert/copy statement.
> > >
> > > This clause should allow to  save records that can't fit into destination
> > > table because of type, check of referential constaints into error table.
> > > Oracle has similar functionality and we are using it in our project. No
> > > error is generated - no transaction rollback, batch abort or similar.
> > >
> > > As for me it would cover 90% of use cases and would be really usefull.
> > The
> > > one problem I can see is with inserting into partition parent.
> >
> > PL/PGSQL provides this functionality. It requires the creation of a server
> > side function and using that function to insert data, but it can do exactly
> > what you're describing.
> >
> > While adding other mechanisms to make it "easier" or "more like some other
> > software" might be valuable; the simple fact is that Postgres _does_
> > support
> > what you want. The fact that you're not aware of it doesn't change that.
> >
> > --
> > Bill Moran
> >


-- 
Bill Moran


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (73+ messages)  latest in thread

Message-ID: <20160220120901.58bea0d780fad45775f04bfa@potentialtech.com>
Permalink:  ../20160220120901.58bea0d780fad45775f04bfa@potentialtech.com/
Also on:    postgresql.org/message-id/20160220120901.58bea0d780fad45775f04bfa@potentialtech.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: wmoran@potentialtech.com, vit@tym.im, craig@2ndquadrant.com, david.g.johnston@gmail.com, pierce@hogranch.com
  Subject: Re: JDBC behaviour
  In-Reply-To: <20160220120901.58bea0d780fad45775f04bfa@potentialtech.com>
  References: <VisenaEmail.10e.692062643617cb13.152f4695802@tc7-visena> <954cc530fdaf2c5cf63dcb180d05fb56@imap.procolix.com> <CAGuFTBXSwk2UmFs_b0wYuTv_BFtLwVmco1mgT5OSb+dwX-U+Sw@mail.gmail.com> <4C508581-9CA3-490D-A376-CC1F9FF5D258@me.com> <CAGuFTBW_xcn5nWtggiwq46f=6Rc5TYEqwtmiWEEGGfB+PSLbUg@mail.gmail.com> <CAMsr+YH3NHZ__xSxWfVH4neGa6w8nLRuLLRG8kqXt9bgE1eEBA@mail.gmail.com> <56C8487F.7020406@hogranch.com> <CAMsr+YF6nj0Qh+A0J3hJrQD1ofwq_=k_tXUewb0EQO_0uj7Azg@mail.gmail.com> <CAKFQuwbo6QZ7dae91mPcnXJyija4EfDX4=F_ULta2hXf4XwbEw@mail.gmail.com> <CABWW-d3Mu=vto2ML22Q+iQe-znNkQLyyew_FJmZn086oBLiqKA@mail.gmail.com> <20160220111625.4ee764661333e42e230348ad@potentialtech.com> <CABWW-d3dDrDQbKA1uh5o3XzFcLrzc7QtHkRsxSdrznUUD=Vq6Q@mail.gmail.com> <20160220120901.58bea0d780fad45775f04bfa@potentialtech.com>

* 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