From 9031a4c13bdb1ee4d0f1253fcfcad73d26c25740 Mon Sep 17 00:00:00 2001
From: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Date: Fri, 24 Jun 2016 15:34:15 +0500
Subject: [PATCH] Fixed #26657 -- Made GeomValue omit SRID for MySQL.

This fixes some test failures on MySQL 5.7+.
---
 django/contrib/gis/db/models/functions.py | 3 +++
 docs/releases/1.9.9.txt                   | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py
index fc572fc9b1..afc87bfb3a 100644
--- a/django/contrib/gis/db/models/functions.py
+++ b/django/contrib/gis/db/models/functions.py
@@ -74,6 +74,9 @@ class GeomValue(Value):
     def as_sql(self, compiler, connection):
         return '%s(%%s, %s)' % (connection.ops.from_text, self.srid), [connection.ops.Adapter(self.value)]
 
+    def as_mysql(self, compiler, connection):
+        return '%s(%%s)' % (connection.ops.from_text), [connection.ops.Adapter(self.value)]
+
     def as_postgresql(self, compiler, connection):
         if self.geography:
             self.value = connection.ops.Adapter(self.value, geography=self.geography)
diff --git a/docs/releases/1.9.9.txt b/docs/releases/1.9.9.txt
index 8e90f6c8dd..a777b17021 100644
--- a/docs/releases/1.9.9.txt
+++ b/docs/releases/1.9.9.txt
@@ -11,3 +11,5 @@ Bugfixes
 
 * Fixed invalid HTML in template postmortem on the debug page
   (:ticket:`26938`).
+
+* Fixed some GIS database function crashes on MySQL 5.7 (:ticket:`26657`).