Fix regression on PostgreSQL query generator