Re: Using the database to validate data

From: JPLapham <lapham(at)jandr(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using the database to validate data
Date: 2015-07-23 22:34:55
Message-ID: 1437690895129-5859160.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tim Clarke wrote
> Shouldn't be too difficult to import those new rows into one table,
> write a procedure that inserts them into the real table one by one and
> logs the validation failure if any - committing good rows and rolling
> back bad. In fact if you could then write the failures to a third table
> with a completely relaxed (or no) validation?

Tim-

Thanks for your response. Yes, you are right, it shouldn't be too difficult,
and in fact I have already implemented basically what you suggest, see "Idea
2" from my original message.

The problem with this approach is that it fails to find violations such as
UNIQUE (there are probably others) from within the input data until after
the first has been committed to the database. But, the error may have been
with that earlier row, not the later.

I want my users to fix all the problems with their data and then load it in
an "all or none" fashion.

-Jon

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

--
View this message in context: http://postgresql.nabble.com/Using-the-database-to-validate-data-tp5859046p5859160.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2015-07-23 23:50:58 Schema Help Needed To Get Unstuck
Previous Message Karsten Hilbert 2015-07-23 22:15:33 Re: Delete rule does not prevent truncate