Exegesis Spatial Data Management

 

Invalid column name problem with GeoServer 2.3 and SQL Server views

I have been getting this error with a WMS layer based on a SQL Server 2008 view, when using a GetFeatureInfo request:

java.lang.RuntimeException: java.io.IOException java.io.IOException null Invalid column name 'VALI, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) AS _GT_ROW_NUMBER DFROM'.

I eventually discovered that the cause is having a field name containing the string "FROM". Specifically, I had

...t3.VALID_FROM AS VALIDFROM , t3.VALID_TO AS VALIDTO,...

This suggests some pretty sloppy SQL parsing in GeoServer, and for the moment I've resolved this by changing my alias to VALID_STARTDATE.

Comments

https://www.esdm.co.uk/invalid-column-name-problem-with-geoserver-23-and-sql-server-views