sql: Fix population of lastmsgid for empty buffers
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 9 Nov 2017 22:23:22 +0000 (23:23 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Dec 2017 14:13:59 +0000 (15:13 +0100)
commitf509a0d1065d4e42c9eb84e0ffab9e72517df04c
tree394d7b7cec62bc0ec9601a930dcd7d07d748619d
parent0260fbe00ddbd1ce78b1870f40fce969b8f34ee5
sql: Fix population of lastmsgid for empty buffers

Buffers may be empty, in which case the query to determine the last
message ID in them returns NULL, violating the constraint for the
newly introduced column. Use 0 instead.

Closes GH-315.
src/core/SQL/PostgreSQL/version/20/upgrade_001_add_function_populate_lastmsgid.sql
src/core/SQL/SQLite/version/21/upgrade_001_update_buffer_set_lastmsgid.sql