SQL Server Spatial support broken in 3.22 #46907
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
MS SQL data provider
Regression
Something which used to work, but doesn't anymore
What is the bug or the crash?
SQL Server spatial tables no longer display in QGIS.
Steps to reproduce the issue
Nothing is displayed. Profiling the SQL shows a malformed SQL statement:
SELECT ,[OBJ] FROM [dbo].[POINTS] WHERE [OBJ].STIsValid() = 1 AND [OBJ].Filter([]::STGeomFromText('POLYGON((120.16606060606059714 -28.75999999999999446, 121.49818181818179141 -28.75999999999999446, 121.49818181818179141 -27.91999999999999815, 120.16606060606059714 -27.91999999999999815, 120.16606060606059714 -28.75999999999999446))',4326)) = 1
By comparing to the SQL generated by 3.16 we can see that it is missing the fieldname immediately after SELECT and the geometry type in the filter statement:
SELECT [POINTID],[OBJ] FROM [dbo].[POINTS] WHERE [OBJ].STIsValid() = 1 AND [OBJ].Filter([geography]::STGeomFrom [Create_QGIS_TEST.sql.txt](https://github.com/qgis/QGIS/files/7902614/Create_QGIS_TEST.sql.txt) Text('POLYGON((120.01937499999999659 -28.75999999999999446, 121.05812499999998977 -28.75999999999999446, 121.05812499999998977 -27.91999999999999815, 120.01937499999999659 -27.91999999999999815, 120.01937499999999659 -28.75999999999999446))',4326)) = 1
Note: The presence of a populated geometry_columns table in the database makes no difference.
QGIS_Crash.txt
Create_QGIS_TEST.txt
Versions
QGIS version
3.22.3-Białowieża
QGIS code revision
1628765
Qt version
5.15.2
Python version
3.9.5
GDAL/OGR version
3.4.1
PROJ version
8.2.1
EPSG Registry database version
v10.041 (2021-12-03)
GEOS version
3.10.0-CAPI-1.16.0
SQLite version
3.35.2
PDAL version
2.3.0
PostgreSQL client version
13.0
SpatiaLite version
5.0.1
QWT version
6.1.3
QScintilla2 version
2.11.5
OS version
Windows Server 2016 Version 1809
Active Python plugins
olivier
2.0
plugin_reloader
0.9.1
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.5
processing
2.12.99
sagaprovider
2.12.99
Supported QGIS version
New profile
Additional context
SQL Server version is 2019, but setting the compatibility level back to earlier versions makes no difference.
Expanding the POINTS table in the browser causes QGIS to crash. Crash report attached but perhaps that should be a separate ticket.
The text was updated successfully, but these errors were encountered: