PostreSQL compatibility, fixes #2666
Merge pull request #2680 from owncloud/fix_2666

PostgreSQL compatibility, fixes #2666