diff --git a/tests/test_version.py b/tests/test_version.py
index 40f0cc6bfc3045dd007631bfcf728cbbe093cc5f..8d45090db0810a1766d92e74d0c2864a13d99e55 100644
--- a/tests/test_version.py
+++ b/tests/test_version.py
@@ -722,3 +722,28 @@ def test_update_name():
                                     "@" + old_version.id, sync=False)[0]
     assert rt_old.version.id == old_version.id
     assert rt_old.name == old_name
+
+
+def test_overridden_datatype():
+    """A bug in the mysql backend resultet in a server error when the old
+    version of an entity was retrieved where the datatype of a property has
+    been overriden.
+
+    Original error in the server logs:
+    ```
+    org.caosdb.server.database.exceptions.TransactionException: java.sql.SQLSyntaxErrorException: Unknown column 'datatypeID' in 'where clause'
+        at org.caosdb.server.database.backend.implementation.MySQL.MySQLRetrieveProperties.execute(MySQLRetrieveProperties.java:70)
+    ```
+    """
+    p = c.Property("TestProperty", datatype=c.TEXT).insert()
+    rt = c.RecordType("TestRT")
+    rt.add_property("TestProperty", datatype=c.LIST(c.TEXT))
+    rt.insert()
+
+    rt.description = "Updated TestRT"
+    rt.update()
+
+    # retrieve the old version (cache flag must be set to "false")
+    rt_old = c.Container().retrieve(query=str(rt.id) + "@HEAD~1",
+                                    flags={"cache": "false"}, sync=False)
+    assert rt.get_property("TestProperty").datatype == c.LIST(c.TEXT)