Issue #1105862 by druido: Fix syntax in MySQL-specific query that resulted in PDOException with PostgreSQL.