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.
This commit is contained in:
John Ralls 2018-05-25 12:58:39 -07:00
parent 5708707f6c
commit 243bf8afce

View File

@ -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);