Small fix to avoid SQL error
Merge pull request #2037 from remenska/rel-v6r12

[v6r12] Small bugfix to avoid SQL errors