From 950ce787b26b3b3afd0ff76151fdf72d1381b7a1 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Sun, 4 Apr 2021 22:44:07 +0200
Subject: Database: nullify auth_name, code of usage table

We never select by those columns, so don't set them. Reduce from 8.4 to
7.9 MB.

Upgrade the minor version of the database layout. (that database can
still be read by PROJ 8.0)
---
 data/sql/proj_db_table_defs.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'data/sql/proj_db_table_defs.sql')

diff --git a/data/sql/proj_db_table_defs.sql b/data/sql/proj_db_table_defs.sql
index 08f74c34..9b1d3dce 100644
--- a/data/sql/proj_db_table_defs.sql
+++ b/data/sql/proj_db_table_defs.sql
@@ -86,8 +86,8 @@ CREATE TABLE scope(
 );
 
 CREATE TABLE usage(
-    auth_name TEXT NOT NULL CHECK (length(auth_name) >= 1),
-    code INTEGER_OR_TEXT NOT NULL CHECK (length(code) >= 1),
+    auth_name TEXT CHECK (auth_name IS NULL OR length(auth_name) >= 1),
+    code INTEGER_OR_TEXT CHECK (code IS NULL OR length(code) >= 1),
     object_table_name TEXT NOT NULL CHECK (object_table_name IN (
         'geodetic_datum', 'vertical_datum',
         'geodetic_crs', 'projected_crs', 'vertical_crs', 'compound_crs',
@@ -1490,7 +1490,7 @@ CREATE VIEW authority_list AS
     UNION
     SELECT DISTINCT auth_name FROM scope
     UNION
-    SELECT DISTINCT auth_name FROM usage
+    SELECT DISTINCT auth_name FROM usage WHERE auth_name IS NOT NULL
     UNION
     SELECT DISTINCT auth_name FROM prime_meridian
     UNION
-- 
cgit v1.2.3

