Ticket #4494 (new enhancement)

Opened 17 months ago

Last modified 17 months ago

OGR SQL: select distinct and case sensitivity

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: ogr sql
Cc:

Description

I am not sure if the below result is a feature or a bug but I would have thought that select DISTINCT is case insensitive

ogrinfo My_Shape.shp -sql "select distinct MS from My_Shape"

  MS (String) = UK

  MS (String) = Uk

  MS (String) = uk

Change History

Changed 17 months ago by rouault

  • keywords ogr sql added
  • type changed from defect to enhancement
  • component changed from default to OGR_SF

I've tested with sqlite, postgresql and mysql. The default behaviour is that sqlite and postgresql are case sensitive like OGR SQL, and that MySQL is case insensitive. For all, this can be changed in various ways, mainly through collation or using upper

ogrinfo pg:dbname=autotest -sql "select distinct upper(foo) from test" --> PG sensitive
ogrinfo test.sqlite -sql "select distinct upper(foo) from test" --> SQLite sensitive
ogrinfo test.sqlite -sql "select distinct foo collate nocase from test" --> SQLite sensitive
ogrinfo mysql:autotest -sql "select distinct foo collate latin1_bin from test" -> MySQL insensitive

So I guess OGR current behaviour is acceptable. But it might be nice to have an option to do case insensitive queries.

Note: See TracTickets for help on using tickets.