]> uap-core.de Git - rssreader.git/commitdiff
add fallback in case no guid was specified (link + pubdate)
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 13 Sep 2025 14:58:26 +0000 (16:58 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 13 Sep 2025 14:58:26 +0000 (16:58 +0200)
rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt

index 92d30207a0dd92a53f5aa830c5635ba2025374b2..d0b74444f8d5adc1333f8790d9ccaeb45fda8748 100644 (file)
@@ -332,7 +332,7 @@ object Database {
             conn.prepareStatement("""
                     merge into items i
                     using (select cast(? as int) as feed_id, cast(? as varchar) as title, cast(? as varchar) as link, cast(? as varchar) as category, cast(? as varchar) as description, cast(? as varchar) as author, cast(? as timestamp) as pub_date, cast(? as timestamp) as updated, cast(? as varchar) as guid, cast(? as clob) as contentText, cast(? as clob) as contentHtml) v
-                    on (i.feed_id = v.feed_id and i.guid = v.guid and coalesce(i.updated, i.pub_date, '1970-01-01') = coalesce(v.updated, v.pub_date, '1970-01-01'))
+                    on (i.feed_id = v.feed_id and coalesce(i.guid, concat(i.link, cast(coalesce(i.pub_date, i.updated) as varchar))) = coalesce(v.guid, concat(v.link, cast(coalesce(v.pub_date, v.updated) as varchar))) and coalesce(i.updated, i.pub_date, '1970-01-01') = coalesce(v.updated, v.pub_date, '1970-01-01'))
                     when matched then
                     update set
                         i.title = v.title,