From 6711ceb662a997d4f44743266a792ec762790d05 Mon Sep 17 00:00:00 2001 From: Habeas Codice Date: Mon, 7 Sep 2015 16:28:42 -0700 Subject: fix postgres zotfeed --- include/items.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 01b4a3460..981f52d7a 100755 --- a/include/items.php +++ b/include/items.php @@ -4588,10 +4588,12 @@ function zot_feed($uid,$observer_hash,$arr) { $items = array(); - /** @FIXME fix this part for PostgreSQL */ + /** @FIXME re-unite these SQL statements. There is no need for them to be separate. The mySQL is convoluted with misuse of group by. As it stands, there is a slight difference where the postgres version doesn't remove the duplicate parents up to 100. In practice this doesn't matter. It could be made to match behavior by adding "distinct on (parent) " to the front of the selection list, at a not-worth-it performance penalty (page temp results to disk). duplicates are still ignored in the in() clause, you just get less than 100 parents if there are many children. */ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - return array(); + $groupby = ''; + } else { + $groupby = 'GROUP BY parent'; } if(is_sys_channel($uid)) { @@ -4599,7 +4601,7 @@ function zot_feed($uid,$observer_hash,$arr) { WHERE uid != %d AND item_private = 0 AND item_restrict = 0 AND uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ") AND (item_flags & %d) > 0 - $sql_extra GROUP BY parent ORDER BY created ASC $limit", + $sql_extra $groupby ORDER BY created ASC $limit", intval($uid), intval(ITEM_WALL) ); @@ -4608,7 +4610,7 @@ function zot_feed($uid,$observer_hash,$arr) { $r = q("SELECT parent, created, postopts from item WHERE uid = %d AND item_restrict = 0 AND (item_flags & %d) > 0 - $sql_extra GROUP BY parent ORDER BY created ASC $limit", + $sql_extra $groupby ORDER BY created ASC $limit", intval($uid), intval(ITEM_WALL) ); -- cgit v1.2.3