[#2916] Improve code generator compatibility with PostgreSQL 8.x by avoiding the use of window functions