Fix invoice item ordering issue with PostgreSQL