Opened 9 years ago
Closed 8 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: | |
Cc: |
Description
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 , 9 years ago
comment:2 by , 9 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 , 9 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 , 9 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 , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
If the need is GUID, I don't see any short or medium term solution to this. Closing.
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'
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