From 243bf8afce7b19dcb1bc869f708ad5c99bd53275 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 25 May 2018 12:58:39 -0700 Subject: [PATCH] Bug 796369 - Notes lost or perhaps just not displaying when using... SQLite backend. Release Note: This bug caused data loss if you saved your SQLite3 database to a different file or database. The problem is that in SQLite3 (though not in MySQL or PgSQL) the subquery ((SELECT DISTINCT guid FROM transactions)) (note the double parentheses) returns only the first guid in the subquery's results. Some transactions are loaded by special queries and those queries are also used to retrieve the transaction's slots so they weren't affected. --- libgnucash/backend/sql/gnc-transaction-sql.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnucash/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp index 1627183420..f2e2b1fc5f 100644 --- a/libgnucash/backend/sql/gnc-transaction-sql.cpp +++ b/libgnucash/backend/sql/gnc-transaction-sql.cpp @@ -391,8 +391,8 @@ query_transactions (GncSqlBackend* sql_be, std::string selector) if (selector.empty()) { - selector = "(SELECT DISTINCT "; - selector += tpkey + " FROM " TRANSACTION_TABLE ")"; + selector = "SELECT DISTINCT "; + selector += tpkey + " FROM " TRANSACTION_TABLE; } gnc_sql_slots_load_for_sql_subquery (sql_be, selector, (BookLookupFn)xaccTransLookup);