44 lines
1.9 KiB
Diff
44 lines
1.9 KiB
Diff
From eac52e3db3c472e35af41f664ae686c0d26739d0 Mon Sep 17 00:00:00 2001
|
|
From: Carlos Garnacho <carlosg@gnome.org>
|
|
Date: Fri, 13 Feb 2015 13:54:13 +0100
|
|
Subject: [PATCH] data-manager: Account for cardinality=0 on DB migration
|
|
|
|
If a property changes from maxCardinality 1 to many, the database
|
|
format is updated to cope with that, but at the time of migrating
|
|
data, it doesn't account for resources having no elements. In order
|
|
to avoid constraint errors, those must be skipped.
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=743727
|
|
---
|
|
src/libtracker-data/tracker-data-manager.c | 11 ++++++-----
|
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
|
|
index 74c8fc6..384a98a 100644
|
|
--- a/src/libtracker-data/tracker-data-manager.c
|
|
+++ b/src/libtracker-data/tracker-data-manager.c
|
|
@@ -3206,14 +3206,15 @@ create_decomposed_metadata_tables (TrackerDBInterface *iface,
|
|
|
|
/* Function does what it must do, so reusable atm */
|
|
range_change_for (property, n_in_col_sql, n_sel_col_sql, field_name);
|
|
-
|
|
- /* Columns happen to be the same for decomposed multi-value and single value atm */
|
|
+
|
|
+ /* Columns happen to be the same for decomposed multi-value and single value atm */
|
|
|
|
query = g_strdup_printf ("INSERT INTO \"%s_%s\"(%s) "
|
|
- "SELECT %s FROM \"%s_TEMP\"",
|
|
+ "SELECT %s FROM \"%s_TEMP\" "
|
|
+ "WHERE ID IS NOT NULL AND \"%s\" IS NOT NULL",
|
|
service_name, field_name,
|
|
- n_in_col_sql->str, n_sel_col_sql->str,
|
|
- service_name);
|
|
+ n_in_col_sql->str, n_sel_col_sql->str,
|
|
+ service_name, field_name);
|
|
|
|
g_string_free (n_in_col_sql, TRUE);
|
|
g_string_free (n_sel_col_sql, TRUE);
|
|
--
|
|
2.1.0
|
|
|