47db787
Fix wrong SQL query when using MBS with PostgreSQL. This fixes following error: ProgrammingError: (ProgrammingError) SELECT DISTINCT ON expressions must match initial ORDER BY expressions