[DBAL-412] Fix postgresql query
Merge branch 'DBAL-412' into 2.3