Changeset 589 in code


Ignore:
Timestamp:
Sep 14, 2021, 4:38:58 PM (4 years ago)
Author:
hubert
Message:

Use NULL-tolerant comparison for DeliveryReceipts

Since NULL = NULL is always FALSE, this query needs to use IS instead.
This should fix the flood of DeliveryReceipts in the DB.

See https://www.sqlite.org/lang_expr.html

The IS and IS NOT operators work like = and != except when one or both
of the operands are NULL. In this case, if both operands are NULL,
then the IS operator evaluates to 1 (true) and the IS NOT operator
evaluates to 0 (false). If one operand is NULL and the other is not,
then the IS operator evaluates to 0 (false) and the IS NOT operator is
1 (true). It is not possible for an IS or IS NOT expression to
evaluate to NULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/db_sqlite.go

    r588 r589  
    543543        defer tx.Rollback()
    544544
    545         _, err = tx.Exec("DELETE FROM DeliveryReceipt WHERE network = ? AND client = ?",
     545        _, err = tx.Exec("DELETE FROM DeliveryReceipt WHERE network = ? AND client IS ?",
    546546                networkID, toNullString(client))
    547547        if err != nil {
Note: See TracChangeset for help on using the changeset viewer.