Opened 10 years ago

Closed 10 years ago

#5654 closed defect (wontfix)

ID column type cannot be changed with COLUMN_TYPES layer creation option

Reported by: zimmi Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:


This options works fine for other columns, but it has no effect whatsoever on FID column. Tested on GDAL 1.10.1, released 2013/08/26 with Ubuntu 12.04. Is there any workaround for this?

Change History (5)

comment:1 by Jukka Rahkonen, 10 years ago

Why would you like to change it and into which datatype? As far as I know FID is critical because is acts as primary key.

If you want write out fids as something else than integers it seems to be possible with CAST.

C:\GDAL_dev>ogrinfo -al cities.shp -sql "select cast(FID as character) from cities" INFO: Open of `cities.shp'

using driver `ESRI Shapefile' successful.

Layer name: cities Geometry: Point Feature Count: 3 Extent: (23.903381, 63.768936) - (25.984792, 66.586845) Layer SRS WKT: (unknown) FID: String (1.0) OGRFeature(cities):0

FID (String) = 0 POINT (23.903381170918806 66.586845471705118)

comment:2 by zimmi, 10 years ago

I'd like to change to guid (varchar32 [a-z][0-9]). I need to write them in as something else, not out. I guess it would be possible with SQL ALTER TABLE, but doing it with GDAL would be much more elegant.

comment:3 by Jukka Rahkonen, 10 years ago

Into what datastore? Some database I guess. But shouldn't guids be something globally unique? I don't believe that changing the datatype of integers makes them especially unique.

comment:4 by zimmi, 10 years ago

Yes, they are globally unique and as such they are created on a server side. Thing is I want to import a layer with ogr2ogr and start editing it - when edits are saved and new data are added, I'd like them added with guid rather than serial.

Now I think about it you're probably right. It would be easier to leave it to the database store with the serial type.

But still, it would be nice to have such an option of redefining fid data type.

comment:5 by Even Rouault, 10 years ago

Resolution: wontfix
Status: newclosed

If the need is GUID, I don't see any short or medium term solution to this. Closing.

Note: See TracTickets for help on using tickets.