Le dimanche 15 janvier 2012 15:20:32, aperi2007 a écrit : > > The integer primary column might be going into the sqlite datasource > > > >as > > > > the FID. > > Hi Chaitanya, > > unfortunatelly seem no. > > To have a more test I try to export from PG to shapefile. > I can confirm that the integer primary key field is lost in exportation. > > I notice also that this happened only if I ask to ogr2ogr to export to > shapefile a full schema. > Instead if I ask to ogr2ogr to export only one table using the -sql > "select * from table_test" , the primary key integer is correctly exported.
I'm not sure why you see a difference of behaviour between the 2 syntax. Perhaps it is due to the way the primary key has been defined. It might be that when given by layer name, OGR detects the primary key column, whereas it doesn't when passed with -sql. Could you paste the schema of the table ? Otherwise, FID are special columns in OGR. If you want to preserve them with ogr2ogr, you need to add the -preserve_fid option in the ogr2ogr command line. > > Andrea. > > Il 14/01/2012 11:59, Chaitanya kumar CH ha scritto: > > Andrea, > > > > The integer primary column might be going into the sqlite datasource as > > the FID. > > > > On Sat, Jan 14, 2012 at 1:35 AM, aperi2007 <aperi2...@gmail.com > > > > <mailto:aperi2...@gmail.com>> wrote: > > Hi, > > > > I notice that try-ing exporting from Postgres using ogr2ogr.exe > > It lost completely the primary key filed if that is a integer field. > > Instead it don't lost the same primary key field if it is a varchar > > type. > > > > Is a know bug this ? > > > > I'm use the gdal 1.9. > > > > I try exporting to a spatialite or to a shapefile. > > Both report the lost of the field PK. > > > > The sintax I'm using is this: > > > > ogr2ogr.exe --config PG_LIST_ALL_TABLES YES --config PG_SKIP_VIEWS > > YES -f "SQLite" prova.sqlite -progress PG:"dbname='test' > > active_schema=work schemas=work host='local' port='5432' > > user='postgres' > > password='postgres' " -overwrite -lco LAUNDER=yes -dsco > > SPATIALITE=yes -lco SPATIAL_INDEX=yes -gt 65536 > > > > Thx, > > > > Andrea. > > > > _________________________________________________ > > gdal-dev mailing list > > gdal-dev@lists.osgeo.org <mailto:gdal-dev@lists.osgeo.org> > > http://lists.osgeo.org/__mailman/listinfo/gdal-dev > > <http://lists.osgeo.org/mailman/listinfo/gdal-dev> > > > > -- > > Best regards, > > Chaitanya kumar CH. > > > > +91-9494447584 > > 17.2416N 80.1426E > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev