From 61020446d81522d659ef286be94da7e2f530d9cd Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@fripost.org>
Date: Sun, 27 Oct 2024 23:33:25 +0100
Subject: PostgreSQL: Use `character varying (n)` not `character (n)`.

Forgot that PostgreSQL space-pads the latter, and that the former
doesn't in fact yield extra storage costs, cf.
https://www.postgresql.org/docs/13/datatype-character.html
---
 schema.sql | 66 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 7249816..b32bc00 100644
--- a/schema.sql
+++ b/schema.sql
@@ -283,7 +283,7 @@ CREATE TABLE postgis."mrr:bearbetningskoncessioner_applied" (
     "Mineral" character varying(254) NOT NULL,
     "Applicant" character varying(254) NOT NULL,
     "ApplicationDate" date NOT NULL,
-    "DiaryNr" character(16) NOT NULL,
+    "DiaryNr" character varying(16) NOT NULL,
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -330,7 +330,7 @@ CREATE TABLE postgis."mrr:bearbetningskoncessioner_approved" (
     "Owner" character varying(254) NOT NULL,
     "ValidFrom" date NOT NULL,
     "ValidTo" date NOT NULL,
-    "DiaryNr" character(16),
+    "DiaryNr" character varying(16),
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -374,7 +374,7 @@ CREATE TABLE postgis."mrr:markanvisningar" (
     ogc_fid bigint NOT NULL,
     "Name" character varying(254) NOT NULL,
     "DecisionDate" date,
-    "DiaryNr" character(16),
+    "DiaryNr" character varying(16),
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -420,7 +420,7 @@ CREATE TABLE postgis."mrr:mineral_applied" (
     "Mineral" character varying(254) NOT NULL,
     "Applicant" character varying(254) NOT NULL,
     "ApplicationDate" date NOT NULL,
-    "DiaryNr" character(16) NOT NULL,
+    "DiaryNr" character varying(16) NOT NULL,
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -465,10 +465,10 @@ CREATE TABLE postgis."mrr:mineral_approved" (
     "Name" character varying(254) NOT NULL,
     "Mineral" character varying(254) NOT NULL,
     "Owner" character varying(254) NOT NULL,
-    "LicenceID" character(8) NOT NULL,
+    "LicenceID" character varying(8) NOT NULL,
     "ValidFrom" date NOT NULL,
     "ValidTo" date NOT NULL,
-    "DiaryNr" character(16),
+    "DiaryNr" character varying(16),
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -514,7 +514,7 @@ CREATE TABLE postgis."mrr:olja_gas_diamant_applied" (
     "Mineral" character varying(254) NOT NULL,
     "Applicant" character varying(254) NOT NULL,
     "ApplicationDate" date NOT NULL,
-    "DiaryNr" character(16) NOT NULL,
+    "DiaryNr" character varying(16) NOT NULL,
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -559,10 +559,10 @@ CREATE TABLE postgis."mrr:olja_gas_diamant_approved" (
     "Name" character varying(254) NOT NULL,
     "Mineral" character varying(254) NOT NULL,
     "Owner" character varying(254) NOT NULL,
-    "LicenceID" character(8) NOT NULL,
+    "LicenceID" character varying(8) NOT NULL,
     "ValidFrom" date NOT NULL,
     "ValidTo" date NOT NULL,
-    "DiaryNr" character(16),
+    "DiaryNr" character varying(16),
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -609,7 +609,7 @@ CREATE TABLE postgis."mrr:torvkoncessioner" (
     "Owner" character varying(254) NOT NULL,
     "ValidFrom" date NOT NULL,
     "ValidTo" date NOT NULL,
-    "DiaryNr" character(16),
+    "DiaryNr" character varying(16),
     "LastUpdated" date NOT NULL,
     wkb_geometry postgis.geometry(MultiPolygon,3006) NOT NULL
 );
@@ -652,7 +652,7 @@ ALTER SEQUENCE postgis."mrr:torvkoncessioner_ogc_fid_seq" OWNED BY postgis."mrr:
 CREATE TABLE postgis."nva:Naturvardsverket_Lansstyrelse" (
     ogc_fid bigint NOT NULL,
     "ID" integer NOT NULL,
-    "DIARIENRNV" character(12) NOT NULL,
+    "DIARIENRNV" character varying(12) NOT NULL,
     "STATUS" character varying(32) NOT NULL,
     "OBJNAMN" character varying(64),
     "FASTBET" character varying(64),
@@ -699,7 +699,7 @@ ALTER SEQUENCE postgis."nva:Naturvardsverket_Lansstyrelse_ogc_fid_seq" OWNED BY
 CREATE TABLE postgis."nva:Skogsstyrelsen" (
     ogc_fid bigint NOT NULL,
     "Uuid" uuid NOT NULL,
-    "Beteckn" character(12) NOT NULL,
+    "Beteckn" character varying(12) NOT NULL,
     "ArendeAr" smallint NOT NULL,
     "NvaTyp" character varying(254),
     "Naturtyp" character varying(254),
@@ -793,7 +793,7 @@ ALTER SEQUENCE postgis."nvr:Biosfarsomraden_ogc_fid_seq" OWNED BY postgis."nvr:B
 CREATE TABLE postgis."nvr:Biotopskydd" (
     ogc_fid bigint NOT NULL,
     "Uuid" uuid NOT NULL,
-    "Beteckn" character(12) NOT NULL,
+    "Beteckn" character varying(12) NOT NULL,
     "ArendeAr" smallint NOT NULL,
     "Biotyp" character varying(254) NOT NULL,
     "Naturtyp" character varying(254),
@@ -1549,13 +1549,13 @@ CREATE TABLE postgis."nvr:SCI_Rikstackande" (
     ogc_fid bigint NOT NULL,
     "NAMN" character varying(62) NOT NULL,
     "BEVPLAN" character varying(128) NOT NULL,
-    "SITE_CODE" character(9) NOT NULL,
+    "SITE_CODE" character varying(9) NOT NULL,
     "OMRADESTYP" character varying(16) NOT NULL,
     "UPPLAMNARE" character varying(62) NOT NULL,
-    "SCI_FORSL" character(6) NOT NULL,
-    "SCI_DATUM" character(6),
-    "SAC_DATUM" character(6),
-    "SPA_DATUM" character(6),
+    "SCI_FORSL" character varying(6) NOT NULL,
+    "SCI_DATUM" character varying(6),
+    "SAC_DATUM" character varying(6),
+    "SPA_DATUM" character varying(6),
     "KVALITET" character varying(254) NOT NULL,
     "KARAKTAR" character varying(254) NOT NULL,
     "ARTER" character varying(254),
@@ -1602,13 +1602,13 @@ CREATE TABLE postgis."nvr:SPA_Rikstackande" (
     ogc_fid bigint NOT NULL,
     "NAMN" character varying(62) NOT NULL,
     "BEVPLAN" character varying(128) NOT NULL,
-    "SITE_CODE" character(9) NOT NULL,
+    "SITE_CODE" character varying(9) NOT NULL,
     "OMRADESTYP" character varying(16) NOT NULL,
     "UPPLAMNARE" character varying(62) NOT NULL,
-    "SCI_FORSL" character(6),
-    "SCI_DATUM" character(6),
-    "SAC_DATUM" character(6),
-    "SPA_DATUM" character(6) NOT NULL,
+    "SCI_FORSL" character varying(6),
+    "SCI_DATUM" character varying(6),
+    "SAC_DATUM" character varying(6),
+    "SPA_DATUM" character varying(6) NOT NULL,
     "KVALITET" character varying(254) NOT NULL,
     "KARAKTAR" character varying(254) NOT NULL,
     "ARTER" character varying(254) NOT NULL,
@@ -1903,7 +1903,7 @@ CREATE TABLE postgis."ri:friluftsliv" (
     "LANK_VARDE" character varying(127) NOT NULL,
     "BESLDATUM" date,
     "LAGRUM" character varying(64) NOT NULL,
-    "ARENDENR" character(11) NOT NULL,
+    "ARENDENR" character varying(11) NOT NULL,
     "LANK_BESLU" character varying(127) NOT NULL,
     "AKTIVITET" character varying(127),
     "NATURTYP" character varying(127),
@@ -2299,7 +2299,7 @@ ALTER SEQUENCE postgis."sametinget:flyttled_ogc_fid_seq" OWNED BY postgis."samet
 CREATE TABLE postgis."sks:AvverkAnm" (
     ogc_fid bigint NOT NULL,
     "OBJECTID" integer NOT NULL,
-    "Beteckn" character(12) NOT NULL,
+    "Beteckn" character varying(12) NOT NULL,
     "ArendeAr" smallint NOT NULL,
     "Avverktyp" character varying(254) NOT NULL,
     "Andamal" character varying(62) NOT NULL,
@@ -2353,7 +2353,7 @@ ALTER SEQUENCE postgis."sks:AvverkAnm_ogc_fid_seq" OWNED BY postgis."sks:AvverkA
 CREATE TABLE postgis."sks:UtfordAvverk" (
     ogc_fid bigint NOT NULL,
     "OBJECTID" integer NOT NULL,
-    "Beteckn" character(12),
+    "Beteckn" character varying(12),
     "ArendeAr" smallint NOT NULL,
     "Avverktyp" character varying(254) NOT NULL,
     "Skogstyp" character varying(254) NOT NULL,
@@ -2571,10 +2571,10 @@ ALTER SEQUENCE postgis."svk:transmissionsnatsprojekt_ogc_fid_seq" OWNED BY postg
 
 CREATE TABLE postgis."vbk:havsbaserad_vindkraft" (
     ogc_fid bigint NOT NULL,
-    "OmrID" character(10) NOT NULL,
+    "OmrID" character varying(10) NOT NULL,
     "Projektnamn" character varying(62),
     "Organisationsnamn" character varying(254),
-    "Organisationsnummer" character(11),
+    "Organisationsnummer" character varying(11),
     "Projektstatus" character varying(62) NOT NULL,
     "Diarienummer" character varying(254),
     "AndringsansokanPagar" boolean,
@@ -2644,7 +2644,7 @@ ALTER SEQUENCE postgis."vbk:havsbaserad_vindkraft_ogc_fid_seq" OWNED BY postgis.
 
 CREATE TABLE postgis."vbk:projekteringsomraden" (
     ogc_fid bigint NOT NULL,
-    "OmrID" character(10) NOT NULL,
+    "OmrID" character varying(10) NOT NULL,
     "Projektnamn" character varying(62),
     "AntalVerk" smallint NOT NULL,
     "AntalEjXY" smallint NOT NULL,
@@ -2654,7 +2654,7 @@ CREATE TABLE postgis."vbk:projekteringsomraden" (
     "AndringsansokanPagar" boolean,
     "UnderByggnation" boolean,
     "Organisationsnamn" character varying(254),
-    "Organisationsnummer" character(11),
+    "Organisationsnummer" character varying(11),
     "ElNamn" character varying(62) NOT NULL,
     "SenasteUppdaterat" date,
     "EjAktuell" boolean NOT NULL,
@@ -2699,8 +2699,8 @@ ALTER SEQUENCE postgis."vbk:projekteringsomraden_ogc_fid_seq" OWNED BY postgis."
 
 CREATE TABLE postgis."vbk:vindkraftverk" (
     ogc_fid bigint NOT NULL,
-    "VerkID" character(14) NOT NULL,
-    "OmrID" character(10) NOT NULL,
+    "VerkID" character varying(14) NOT NULL,
+    "OmrID" character varying(10) NOT NULL,
     "Projektnamn" character varying(62),
     "Status" character varying(62) NOT NULL,
     "Statuskod" smallint NOT NULL,
@@ -2715,7 +2715,7 @@ CREATE TABLE postgis."vbk:vindkraftverk" (
     "Fabrikat" character varying(62),
     "Modell" character varying(62),
     "Organisationsnamn" character varying(254),
-    "Organisationsnummer" character(11),
+    "Organisationsnummer" character varying(11),
     "Placering" character varying(62),
     "ElNamn" character varying(62) NOT NULL,
     "SenasteUppdaterat" date,
-- 
cgit v1.2.3

