From: Michael Marley Date: Thu, 9 Mar 2017 15:46:14 +0000 (-0500) Subject: Fix lastseenmsgid updates in PostgreSQL X-Git-Tag: travis-deploy-test~332^2 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5e3bcda8c341dbe6846d4723afe7096acca8f304;hp=8af0ba8424957091f3b661e9f52b787681f0a51d;ds=sidebyside Fix lastseenmsgid updates in PostgreSQL GH-273 introduced a workaround for the issue where sometimes the lastseenmsgid for a buffer was set to a msgid not in that buffer. However, the workaround was incorrect as the "min()" function in PostgreSQL is an aggregate function for use on a column, not a function to return the least of a list of values passed in. The correct function for use here is "least()". --- diff --git a/src/core/SQL/PostgreSQL/20/update_buffer_lastseen.sql b/src/core/SQL/PostgreSQL/20/update_buffer_lastseen.sql index 98218a64..14e5c58d 100644 --- a/src/core/SQL/PostgreSQL/20/update_buffer_lastseen.sql +++ b/src/core/SQL/PostgreSQL/20/update_buffer_lastseen.sql @@ -1,3 +1,3 @@ UPDATE buffer -SET lastseenmsgid = min(:lastseenmsgid, buffer.lastmsgid) +SET lastseenmsgid = least(:lastseenmsgid, buffer.lastmsgid) WHERE userid = :userid AND bufferid = :bufferid