[gdal-dev] GDAL/OGR 2.0.2 RC1 Available for Review
Jürgen E. Fischer
jef at norbit.de
Sat Jan 23 08:33:44 PST 2016
Hi Even,
On Sat, 23. Jan 2016 at 16:10:56 +0100, Even Rouault wrote:
> Here's what I tried:
The problem appears in the following layer. The transaction is still in an
unusable state and hence the next statement also fails (ERROR 1: ERROR: current
transaction is aborted, commands ignored until end of transaction block). In
my case with NAS data - ie. ia source with multiple layers - the retrieval of
the columns of a preexisting table fails.
This also shows the problem:
set -x
ogrinfo pg: -sql "drop table if exists test1; create table test1(id varchar unique, foo varchar); SELECT AddGeometryColumn('test1','dummy',-1,'POINT',2);"
ogrinfo pg: -sql "drop table if exists test2; create table test2(id varchar unique, foo varchar); SELECT AddGeometryColumn('test2','dummy',-1,'POINT',2);"
[ -d test ] || mkdir test
printf "id,foo\n1,1\n" >test/test1.csv
printf "id,foo\n1,1\n" >test/test2.csv
ogr2ogr -update -append pg: test
printf "id,foo\n1,1\n" >test/test1.csv
printf "id,foo\n2,2\n" >test/test2.csv
ogr2ogr -update -append pg: test -skip
ogrinfo pg: test1 test2
Gives:
+ ogrinfo pg: -sql 'drop table if exists test1; create table test1(id varchar unique, foo varchar); SELECT AddGeometryColumn('\''test1'\'','\''dummy'\'',-1,'\''POINT'\'',2);'
INFO: Open of `pg:'
using driver `PostgreSQL' successful.
Layer name: sql_statement
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
addgeometrycolumn: String (0.0)
OGRFeature(sql_statement):1
addgeometrycolumn (String) = public.test1.dummy SRID:-1 TYPE:POINT DIMS:2
+ ogrinfo pg:' -sql 'drop table if exists test2; create table test2(id varchar unique, foo varchar); SELECT AddGeometryColumn('\''test2'\'','\''dummy'\'',-1,'\''POINT'\'',2);'
INFO: Open of `pg:'
using driver `PostgreSQL' successful.
Layer name: sql_statement
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
addgeometrycolumn: String (0.0)
OGRFeature(sql_statement):1
addgeometrycolumn (String) = public.test2.dummy SRID:-1 TYPE:POINT DIMS:2
+ '[' -d test ']'
+ printf 'id,foo\n1,1\n'
+ printf 'id,foo\n1,1\n'
+ ogr2ogr -update -append pg: test
+ printf 'id,foo\n1,1\n'
+ printf 'id,foo\n2,2\n'
+ ogr2ogr -update -append pg: test -skip
ERROR 1: ERROR: duplicate key value violates unique constraint "test1_id_key"
ERROR 1: INSERT command for new feature failed.
ERROR: duplicate key value violates unique constraint "test1_id_key"
Command: INSERT INTO "test1" ("id", "foo") VALUES ('1', '1')
ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR 1: ERROR: current transaction is aborted, commands ignored until end of transaction block
+ ogrinfo 'pg:' test1 test2
INFO: Open of `pg:'
using driver `PostgreSQL' successful.
Layer name: test1
Geometry: Point
Feature Count: 1
Layer SRS WKT:
(unknown)
Geometry Column = dummy
id: String (0.0)
foo: String (0.0)
OGRFeature(test1):0
id (String) = 1
foo (String) = 1
Layer name: test2
Geometry: Point
Feature Count: 2
Layer SRS WKT:
(unknown)
Geometry Column = dummy
id: String (0.0)
foo: String (0.0)
OGRFeature(test2):0
id (String) = 1
foo (String) = 1
OGRFeature(test2):1
id (String) = (null)
foo (String) = (null)
The last row is from 'INSERT INTO "test2" DEFAULT VALUES' - which is used
because the retrieval of the columns of "test2" failed.
Jürgen
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160123/e623c584/attachment.sig>
More information about the gdal-dev
mailing list