Fix some queries which doesn't work with postgreSQL
Merge pull request #133 from xillibit/patch-11

Fix some queries which doesn't work with postgreSQL