[v2,1/3] location-importer.in: avoid violating NOT NULL constraints during JOIN

Message ID d2919c7d-9712-b4ce-3977-15d2b00f1860@ipfire.org
State Accepted
Headers show
Series
  • [v2,1/3] location-importer.in: avoid violating NOT NULL constraints during JOIN
Related show

Commit Message

Peter Müller Sept. 20, 2020, 7:19 p.m. UTC
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 src/python/location-importer.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/src/python/location-importer.in b/src/python/location-importer.in
index f5ae4a9..77952f2 100644
--- a/src/python/location-importer.in
+++ b/src/python/location-importer.in
@@ -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;
 			""")