id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 4318,"MSSQLSpatial incorrectly assumes an ""image"" type column to be geometry",danhomerick,tamas,"When the geometry column is not explicitly named, the MS SQL Spatial format attempts to autodetect which column contains geometry data. The autodetection logic assumes that any ""image"" type column (a subtype of binary data) contains WKB. Because the ""image"" type, unlike the ""geometry"" and ""geography"" column types is not exclusive to spatial data, this assumption is risky. At connection, the spatial storage format is specified (WKB, WKT, or Native), defaulting to Native. A patch is attached which propagates which storage format is being used down to the autodetection logic, and changes the logic so as to only make the risky assumption about an ""image"" column when the spatial data is stored in WKB. It also allows for WKB which is stored in a ""varbinary"" column type, since the ""image"" column type is deprecated (since SQL Server 2005 [1]). A more comprehensive fix might be to attempt decoding some of the ""image"" column, in order to check that it actually contains WKB. The patch does not address autodetecting a column containing WKT, which was also not addressed by the original code. An alternate fix might be to remove autodetection of geometry columns entirely unless stored in the unambiguous ""geometry"" or ""geography"" types (i.e. native). [1] http://msdn.microsoft.com/en-us/library/ms187993.aspx",defect,closed,normal,,OGR_SF,svn-trunk,normal,fixed,MSSQLSpatial,tamas