diff options
| author | 2019-03-19 20:14:31 +0100 | |
|---|---|---|
| committer | 2019-03-19 20:14:31 +0100 | |
| commit | 834ffacce22ff6a2c0f1459476dc4a45e8ea06f9 (patch) | |
| tree | c38618fc45cd6e0f466ed9d46f59902c4b5b1ccc /app/Models/EntryDAOPGSQL.php | |
| parent | cb00eafba02b5dfe9bfefd8a4b4228cccef9a6bf (diff) | |
No old ID (#2276)
* No old ID
https://github.com/FreshRSS/FreshRSS/issues/2273
* PostgreSQL insert or ignore
Diffstat (limited to 'app/Models/EntryDAOPGSQL.php')
| -rw-r--r-- | app/Models/EntryDAOPGSQL.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php index aef258b6f..e571e457f 100644 --- a/app/Models/EntryDAOPGSQL.php +++ b/app/Models/EntryDAOPGSQL.php @@ -37,7 +37,9 @@ 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` 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) + WHERE NOT EXISTS ( + SELECT 1 FROM `' . $this->prefix . 'entry` AS ereal + WHERE (etmp.id = ereal.id) OR (etmp.id_feed = ereal.id_feed AND etmp.guid = ereal.guid)) ORDER BY date); DELETE FROM `' . $this->prefix . 'entrytmp` WHERE id <= maxrank; END $$;'; |
