AW: [gdal-dev] Re: ogr2ogr PGSQL_OGR_FID is not work

Even Rouault even.rouault at mines-paris.org
Tue Feb 2 18:22:21 EST 2010


The doc is not very clear about what PGSQL_OGR_FID really does, but my 
understanding of the code and its history is that it was introduced at a time 
when OGR had no yet any autodetection of the name of the primary key column. 
However, it can still be usefull today in cases where no primary key is 
defined.

Anyway, I can say for sure that for the write part of the driver, setting 
PGSQL_OGR_FID is without any effect. The OGC_FID name is hard-coded when 
creating a table.

Le Tuesday 02 February 2010 12:42:52 Christian.Strobl at dlr.de, vous avez 
écrit :
> hi jukka,
>
> thanks for your hint. i have read the section too fast, so PGSQL_OGR_FID
> seems to be an environment variable. i tried also your suggestion, it's the
> right way to define environment variables for windows
>
> SET PGSQL_OGR_FID=myid
>
> but there is no difference neither. i will try it later for linux with
> export.
>
> does anybody know if this PGSQL_OGR_FID option is working at all?
>
> thanks
> christian
>
> p.s. i tried also
>
> SET PGSQL_OGR_FID="myid"
> SET PGSQL_OGR_FID='myid'
>
> > -----Ursprüngliche Nachricht-----
> > Von: gdal-dev-bounces at lists.osgeo.org
> > [mailto:gdal-dev-bounces at lists.osgeo.org] Im Auftrag von
> > Jukka Rahkonen
> > Gesendet: Montag, 1. Februar 2010 16:06
> > An: gdal-dev at lists.osgeo.org
> > Betreff: [gdal-dev] Re: ogr2ogr PGSQL_OGR_FID is not work
> >
> >  <Christian.Strobl <at> dlr.de> writes:
> > > if i try the following command
> > >
> > > ogr2ogr -f PostgreSQL -nln newlayer -nlt MULTIPOLYGON
> > > PG:"host=localhost
> >
> > user=admin password=xxx
> >
> > > dbname=mydb" PG:"host=localhost user=admin password=yyy
> >
> > dbname=otherdb"
> > oldlayer -lco PGSQL_OGR_FID=myid
> >
> > > everything works fine but the primary key remains at the column
> > > "ogc_fid" not
> >
> > at the column "myid".
> >
> > > thanks for every help
> >
> > Hi,
> >
> > I have never tried that but it seems to by in the manual page
> > under subtitle "Environment variables" and not under "Layer
> > creation options".  With Windows it would mean giving a command
> >
> > SET PGSQL_OGR_FID=myid from command line before running
> > ogr2ogr. Must be something similar with Linux.
> >
> > -Jukka-
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list