Skip to content
Snippets Groups Projects
Verified Commit 65e84bd8 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Add test for versioning bug in mysql backend

parent ff3850c8
No related branches found
No related tags found
No related merge requests found
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment