Hi Mark,

  Thanks for your speedy reply.

I appreciate the difficulties caused by the changes to My SQL 8. I personally believe in the importance of preserving backwards compatibility, and this is a classic example of the externalised costs that arise from breaking that.

I'm glad you sometimes get an itch to make progress on this. I read that MySQL is the second-most popular database, so it would be great if GeoTools/GeoServer could get working with it again, even though the questionable design decisions were taken elsewhere.

  Please keep scratching when you can.

Best wishes,

  Martin


------ Original Message ------
From: "mark" <mc.pr...@gmail.com>
To: geotools-devel@lists.sourceforge.net
Sent: 28-Oct-2020 10:02:15
Subject: Re: [Geotools-devel] MySQL 8.0 spatial functions name change bug

As the doc [https://docs.geoserver.org/latest/en/user/data/database/mysql.html] 
says MySQL is an unmaintained and unsupported extension in GeoServer, basically 
that means it gets worked on when someone receives an incentive or gets an itch.

To scratch my itch I've started working on MySQL 8 support but ran out of time. 
MySQL/Oracle has added a (imo) broken definition of geography complicating 
things, only partly supporting version 8 doesn't seem like a great idea to me.
Simple things like getting the envelope are unsupported for geographic CRS in 
the database in version 8 while they worked in earlier versions - mainly 
because everything was treated like a cartesian CRS.

I've just pushed my work-in-progress online to: 
https://github.com/geotools/geotools/pull/3191

see also:
- https://osgeo-org.atlassian.net/browse/GEOT-6690
- https://osgeo-org.atlassian.net/browse/GEOT-6692
- 
https://sourceforge.net/p/geotools/mailman/geotools-devel/thread/CA%2BnxMTsqPczfDQfOb0b79dqaWpTERwCLXeVCR9%3DJ_a2qN9-%3Drw%40mail.gmail.com/#msg37098942



Mark



On 10/27/20 8:29 PM, Martin Baxter via GeoTools-Devel wrote:
Dear GeoTools developers,

   I'm new to your project but have been using GeoServer happily for several 
years.

I tried a recent upgrade to MySQL 8.0 and discovered that the MySQL team have 
made some non-backwards compatible changes which have broken GeoTools. That's a 
shame since MySQL 8 has been around since April 2018 and it would be great to 
have GeoTools compatible with it.

I know from an earlier thread that there are two distinct problems. The harder 
problem is that MySQL have changed how they handle geography and SRIDs, and 
they have changed the order of the co-ordinates in a SRID-dependent way.

But there is also an easier problem, which is that they have switched off the functions "AsWKB" and 
"Envelope" and replaced them with "ST_AsBinary" and "ST_Envelope". I know that GeoTools 
developers tried to be ready for this change, but missed a couple of instances.

I'm not a Java developer myself, but it looks like the problem is concentrated 
in one file:
geotools-24.0\modules\plugin\jdbc\jdbc-mysql\src\main\java\org\geotools\data\mysql\MySQLDialect.java

Around line 228 where the existing code
sql.append("asWKB(");

needs to be replaced with code like

if (usePreciseSpatialOps) {
     sql.append("ST_AsBinary(");
} else {
     sql.append("asWKB(");
}

And lines 234-5 could change from

sql.append("asWKB(");
sql.append("envelope(");

to something like

if (usePreciseSpatialOps) {
     sql.append("ST_AsBinary(");
     sql.append("ST_Envelope(");
} else {
     sql.append("asWKB(");
     sql.append("envelope(");
}

Is it possible for someone to make the easy change and release a new version of 
GeoTools? That would let GeoServer partially operate with MySQL 8.0, and cure 
the current show-stopping bug. I understand that the SRID changes are harder, 
but not everyone is dependent on that fix. It would be great to get the simple 
bug out of the way.

Many thanks for reading this far,

   Best wishes,

     Martin


Martin Baxter




_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel




_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel



_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to