Skip to content
Snippets Groups Projects
Commit 71faec13 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-fix-versioning-bug' into 'dev'

Add test for versioning bug in mysql backend

See merge request caosdb/caosdb-pyinttest!41
parents ff3850c8 b856a630
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.
Finish editing this message first!
Please register or to comment