]> git.ipfire.org Git - location/libloc.git/commitdiff
location-importer.in: avoid violating NOT NULL constraints during JOIN
authorPeter Müller <peter.mueller@ipfire.org>
Sun, 20 Sep 2020 19:19:36 +0000 (19:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 21 Sep 2020 16:15:58 +0000 (16:15 +0000)
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location-importer.in

index f5ae4a9c005f1236228664821babb22d232e5bd4..77952f2eef2a23e86080b9a2874a83d9e9fdbd68 100644 (file)
@@ -360,7 +360,7 @@ class CLI(object):
                                        ON COMMIT DROP;
                                CREATE UNIQUE INDEX _autnums_number ON _autnums(number);
 
-                               CREATE TEMPORARY TABLE _organizations(handle text, name text)
+                               CREATE TEMPORARY TABLE _organizations(handle text, name text NOT NULL)
                                        ON COMMIT DROP;
                                CREATE UNIQUE INDEX _organizations_handle ON _organizations(handle);
                        """)
@@ -373,7 +373,7 @@ class CLI(object):
                        self.db.execute("""
                                INSERT INTO autnums(number, name)
                                        SELECT _autnums.number, _organizations.name FROM _autnums
-                                               LEFT JOIN _organizations ON _autnums.organization = _organizations.handle
+                                               JOIN _organizations ON _autnums.organization = _organizations.handle
                                ON CONFLICT (number) DO UPDATE SET name = excluded.name;
                        """)