claeis / ili2db

interlis import/export to relational databases
30 stars 30 forks source link

failed to create column "offset" #78

Closed pvalsecc closed 7 years ago

pvalsecc commented 7 years ago

If you try to import StandardSymbology.xtf from http://www.interlis.ch/interlis2/docs23/test23_20150413.zip with ili2pg v3.8.1

You get this error in postgresql 9.5:

db_1      | ERROR:  syntax error at or near "offset" at character 286
db_1      | STATEMENT:  CREATE TABLE pattern_symbol (
db_1      |       linestyle_symbols bigint NULL
db_1      |       ,T_Id bigint PRIMARY KEY DEFAULT nextval('t_ili2db_seq')
db_1      |       ,T_Seq bigint NULL
db_1      |       ,fontsymbref bigint NULL
db_1      |       ,colorref bigint NULL
db_1      |       ,weight decimal(13,3) NULL
db_1      |       ,ascale decimal(13,3) NULL
db_1      |       ,dist decimal(13,3) NOT NULL
db_1      |       ,offset decimal(13,3) NOT NULL
db_1      |     )

ili2pg logs:

Info: dburl <jdbc:postgresql://db:5432/geomapfish>
Info: dbusr <www-data>
Info: ili2pg-3.8.1-20170421
Info: ili2c-4.7.2-20170413
Info: iox-ili-1.18.1-master-20170420
Info: java.version 1.8.0_111
Info: user.name <root>
Info: maxMemory 3568128 KB
Info: dburl <jdbc:postgresql://db:5432/geomapfish>
Info: dbusr <www-data>
Info: databaseProduct <PostgreSQL>
Info: databaseVersion <9.5.5>
Info: driverName <PostgreSQL Native Driver>
Info: driverVersion <PostgreSQL 9.4.1208.jre6>
Info: postGISVersion <POSTGIS="2.2.2 r14797" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" TOPOLOGY RASTER>
Info: compile models...
Info: lookup model <StandardSymbology> in repository </data/models>
Info: lookup model <AbstractSymbology> 2.3 in repository </data/models>
Info: ilifile </data/models/AbstractSymbology.ili>
Info: ilifile </data/models/StandardSymbology-20150402.ili>
Info: create table structure...
java.io.IOException: failed to create table pattern_symbol
  failed to create table pattern_symbol
    ERROR: syntax error at or near "offset"
  Position: 286
pvalsecc commented 7 years ago

The SQL should be:

CREATE TABLE pattern_symbol (
"linestyle_symbols" bigint NULL
,"T_Id bigint" PRIMARY KEY DEFAULT nextval('t_ili2db_seq')
,"T_Seq bigint" NULL
,"fontsymbref" bigint NULL
,"colorref" bigint NULL
,"weight" decimal(13,3) NULL
,"ascale" decimal(13,3) NULL
,"dist" decimal(13,3) NOT NULL
,"offset" decimal(13,3) NOT NULL
)

Always put double quotes around identifiers...