#191 - Postgresql and sources/blocks/main_news.php

This is a spacer post for a website comment topic. The content this topic relates to: #191 - Postgresql and sources/blocks/main_news.php
I was aware of this one actually, in the sense of it not meeting the SQL spec rather than the sense of knowing it failing on postgresql. The duplicate records are due to the join. The problem is someone can add a news entry such that it is in the same primary and secondary category and hence it comes out twice. Alternatively, a filter might filter on multiple categories and hence it comes out multiple times.
GROUP BY is the only way I really know to remove duplicates without having to do processing in PHP, which breaks the ability for COUNT(*) to work for pagination or is a performance hit due to reading in lots of rows. Any suggestions welcome!
Ok, this one was tough. The only way to solve without making the code into spaghetti was to do a small compromise. Non-MySQL users will have pagination that gets a bit uneven if items are returned that are in multiple categories that are filtered on, due to the duplicates being taken out (in PHP) and leaving holes in the perceived ordering.
I don't think this'll cause any issues for people.
0 guests and 0 members have recently viewed this.