Teradata Plugin does no honor SRID when creating BBOX filter query

Description

Bounding Box query filter generated in course of previewing published layer in GeoServer does not honor the spatial reference system of the target layer. May not be honored elsewhere either.

1 new ST_Geometry(?)

in the logged query that follows should be

1 new ST_Geometry(?,1619)

where 1619 is coming from the SRID field in the layer's corresponding row of the Geometry_Columns table. Without the explicit specification of the SRID in the constructor for the BBOX geometry, the SRID defaults to 0 and does match the SRID of the feature data against which the intersection is being performed.

Resultant exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 SELECT "GEOM" as "GEOM", CASE WHEN CHARACTERS(cast("GEOM" as clob)) > 30000 THEN NULL ELSE CAST ("GEOM" as VARCHAR(30000)) END as "GEOM_inline" FROM "USDA_DB"."KH_FEATURE" WHERE "GEOM".ST_Intersects(new ST_Geometry(?)) = 1 2016-07-21 10:10:37,022 DEBUG [org.geotools.jdbc] - 1 = POLYGON ((-78.04498672485352 39.10909652709961, -78.04498672485352 39.194583892822266, -77.9124641418457 39.194583892822266, -77.9124641418457 39.10909652709961, -78.04498672485352 39.10909652709961)) 2016-07-21 10:10:37,022 DEBUG [org.geotools.jdbc] - SET QUERY_BAND=? FOR TRANSACTION;1=Process=SELECT; 2016-07-21 10:10:37,068 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION 2016-07-21 10:10:37,068 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION 2016-07-21 10:10:37,068 ERROR [org.geotools.rendering] - java.io.IOException java.lang.RuntimeException: java.io.IOException Caused by: java.sql.SQLException: java.sql.SQLException: [Teradata Database] [TeraJDBC 15.10.00.14] [Error 7548] [SQLState HY000] 13 ST_Intersects: ST_Geometry values cannot have unequal srid's. at org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:178) at org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDBCFeatureSource.java:613) ... 131 more Caused by: java.sql.SQLException: [Teradata Database] [TeraJDBC 15.10.00.14] [Error 7548] [SQLState HY000] 13 ST_Intersects: ST_Geometry values cannot have unequal srid's.

Environment

64 bit Windows 2008 R2 Server
32bit Tomcat 9.0 instance
Geoserver 2.9.0 Web app
Geoserver 2.9.0 Teradata Plugin (gt-jdbc-teradata-15.0.jar)

Status

Assignee

Unassigned

Reporter

Kevin Healy

Triage

None

Components

Affects versions

15.0

Priority

High
Configure