[gdal-dev] Fwd: Catching many errors of the same record (ogr2ogr)

Even Rouault even.rouault at spatialys.com
Thu Jan 14 07:24:02 PST 2021


On jeudi 14 janvier 2021 16:14:55 CET Paolo Cavallini wrote:
> Hi Even, all,
> 
> > On vendredi 8 janvier 2021 15:58:39 CET matteo wrote:
> >> Hi all,
> >> 
> >> I've 2 small questions during a syncing from a GPKG to a PG DB with
> >> constraints using -skipfailures:
> >> 
> >> * is it possible to show only the constraint error and not also the
> >> insert one? Even if there is only a single error, reading the log it
> >> seems that there are 2 of them (I know a person should only read....)
> >> * is there are 2 errors (e.g. constraints error) BUT in the same record,
> >> ogr2ogr shows only the first one and not all of them
> > 
> > Why not experimenting outside GDAL a bit ?
> > 
> > $ psql
> > 
> > # create table foo(bar integer check (bar = 1), baz integer check (baz =
> > 1));
> > # insert into foo values (2,2);
> > ERROR:  new row for relation "foo" violates check constraint
> > "foo_bar_check"
> > DETAIL:  Failing row contains (2, 2).
> > 
> > 
> > and asking your favorite search engine about
> > "postgresql get all constraint violations"
> > 
> > ==>
> > https://stackoverflow.com/questions/23822162/error-message-with-all-constr
> > aint-violations-in-postgres
> thanks Evan for this reply. The approach you suggested work well for an
> interactive session,

That was not at all my point :-) The above was supposed to demonstrate that 
even when using PostgreSQL outside of any GDAL context, you cannot do what you 
want (only one violation reported at a time), so you shouldn't expect GDAL to 
be better than PostgreSQL offers.


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list