[gdal-dev] ogr2ogr and reserved words

Even Rouault even.rouault at mines-paris.org
Fri Jul 13 06:41:39 PDT 2012

Hi Ivan,

> Is there any trick to avoid creating field names with reserved words? For
> example, a DBF from a shapefile can have field names like "long" and other
> formats may not like it.

It is up to the output driver to do whatever sanitizing it requires. This is
already done in a lot of drivers. The last recollection I have is in the FGBD
driver that modifies field names that match a list of reserved keywords. The
shapefile driver will also truncate too long field names, etc.. A bunch of RDBM
drivers have a LAUNDER creation option too. etc etc.

I suspect your question might be related to the OCI driver ? Perhaps it should
do something like the above if needed.

ogr2ogr is able to deal with drivers that have an implementation of
CreateField() that does a renaming/truncation/etc... of the source field name.

You also have the possibility to use the AS capability of OGR SQL to do the
renaming manually.

> Regards,
> Ivan
> _______________________________________________
> 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