[fix] bug with queries when postgresql is used