[gdal-dev] Anyone against making OGR SQL 'SUBSTR' conformant with other SQL implementations ?

Howard Butler hobu.inc at gmail.com
Thu Nov 24 16:50:36 EST 2011



On Nov 24, 2011, at 3:47 PM, Even Rouault <even.rouault at mines-paris.org> wrote:

> Hi,
> 
> The implementation of the OGR SQL SUBSTR(string, offset[, length]) function 
> considers that the character offset is like the convention of the C language, 
> that is to say that the first character is offset 0, the second one is offset 1, 
> etc... All other SQL implementations I've found consider 1 as the first 
> character, 2 as the second one.
> 
> For details and patch, see http://trac.osgeo.org/gdal/ticket/4348
> 
> The only reason I'm reporting publicly here is that fixing that could break 
> existing applications/scripts. The risk seems limited however because this 
> function was introduced in 1.8.0 and happens not to be documented in 
> http://gdal.org/ogr/ogr_sql.html
> 
> So I think I'll apply the fix in trunk, and likely in 1.8 branch too. With a 
> notice in the backward compatibility section of the NEWS file.
> 

+1 to fixing it to be conformant.

Howard


More information about the gdal-dev mailing list