summaryrefslogtreecommitdiff
path: root/classes/feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-12-08 16:59:58 +0300
committerAndrew Dolgov <[email protected]>2020-12-08 17:01:19 +0300
commit71c8d8d365f62ecacceaee9f5fe70c344a18dd4b (patch)
tree430f7bdc6962a8a12f5a4538330815bcd2d450ef /classes/feeds.php
parent7608f3d7b0c1185cc6b756a22dc5ab5540a0c7b2 (diff)
queryFeedHeadlines:
- there should be no need for DISTINCT query when checking for first id - fix DISTINCT query part being undefined when browsing by tags - add query debugging for tags
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-xclasses/feeds.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index c66fe0207..b8c5227aa 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -1785,7 +1785,7 @@ class Feeds extends Handler_Protected {
if (!$search && !$skip_first_id_check) {
// if previous topmost article id changed that means our current pagination is no longer valid
- $query = "SELECT $distinct_qpart
+ $query = "SELECT
ttrss_entries.id,
date_entered,
$yyiw_qpart,
@@ -1871,6 +1871,13 @@ class Feeds extends Handler_Protected {
} else {
// browsing by tag
+ if (DB_TYPE == "pgsql") {
+ $distinct_columns = str_replace("desc", "", strtolower($order_by));
+ $distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
+ } else {
+ $distinct_qpart = "DISTINCT"; //fallback
+ }
+
$query = "SELECT $distinct_qpart
date_entered,
guid,
@@ -1912,6 +1919,10 @@ class Feeds extends Handler_Protected {
//if ($_REQUEST["debug"]) print $query;
+ if ($_REQUEST["debug"]) {
+ print "\n*** TAGS QUERY ***\n$query\n";
+ }
+
$res = $pdo->query($query);
}