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

From JPLapham
Subject Re: Using the database to validate data
Date
Msg-id 1437690895129-5859160.post@n5.nabble.com
Whole thread Raw
In response to Re: Using the database to validate data  (Tim Clarke <tim.clarke@manifest.co.uk>)
Responses Re: Using the database to validate data  (rob stone <floriparob@gmail.com>)
List 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.


pgsql-general by date:

Previous
From: Jon Lapham
Date:
Subject: Re: Using the database to validate data
Next
From: rob stone
Date:
Subject: Re: Using the database to validate data