aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAOPGSQL.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-10-01 18:31:28 +0200
committerGravatar GitHub <noreply@github.com> 2017-10-01 18:31:28 +0200
commitceda55c75b158fc1cf4813fe0f258527754b9289 (patch)
tree7c84ac32cc845ab1d70ea5a3fb263c6613de34b0 /app/Models/EntryDAOPGSQL.php
parentcb7ba3e47576aa1d0c3f53e5966f831e6540bbc3 (diff)
parentf241fc1841df89285ecb6f124f0d70198d712b2f (diff)
Merge pull request #1651 from FreshRSS/dev1.8.0
Release 1.8.0
Diffstat (limited to 'app/Models/EntryDAOPGSQL.php')
-rw-r--r--app/Models/EntryDAOPGSQL.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php
index b25993c47..405774abf 100644
--- a/app/Models/EntryDAOPGSQL.php
+++ b/app/Models/EntryDAOPGSQL.php
@@ -11,7 +11,7 @@ class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {
}
protected function autoUpdateDb($errorInfo) {
- if (isset($errorInfo[0])) {
+ if (isset($errorInfo[0])) {
if ($errorInfo[0] === '42P01' && stripos($errorInfo[2], 'entrytmp') !== false) { //undefined_table
return $this->createEntryTempTable();
}
@@ -30,7 +30,10 @@ maxrank bigint := (SELECT MAX(id) FROM `' . $this->prefix . 'entrytmp`);
rank bigint := (SELECT maxrank - COUNT(*) FROM `' . $this->prefix . 'entrytmp`);
BEGIN
INSERT INTO `' . $this->prefix . 'entry` (id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags)
- (SELECT rank + row_number() OVER(ORDER BY date) AS id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags FROM `' . $this->prefix . 'entrytmp` ORDER BY date);
+ (SELECT rank + row_number() OVER(ORDER BY date) AS id, guid, title, author, content, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags
+ FROM `' . $this->prefix . 'entrytmp` AS etmp
+ WHERE NOT EXISTS (SELECT 1 FROM `' . $this->prefix . 'entry` AS ereal WHERE etmp.id_feed = ereal.id_feed AND etmp.guid = ereal.guid)
+ ORDER BY date);
DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= maxrank;
END $$;';
$hadTransaction = $this->bd->inTransaction();