Skip to content

Commit

Permalink
* Alle SQL-Skripte mit ON_ERROR_STOP=1 ausführen
Browse files Browse the repository at this point in the history
* Exception beim Anlagen des Schemas abfangen, statt Existenz prüfen.
* GDAL1-Unterstützung entfernen
* Ausgabe der Jobs nicht mehr gruppieren
* Fehlerhafte Jobs melden, statt abzubrechen
* Unkomprimierte Gesamtgröße mitprotokollieren
* alkis-compat.sql & alkis-po-tables.sql in alkis-init.sql statt separat laden.
* alkis-schema.sql: in Transaktion anlegen und :postgis_schema in Suchpfad
  einfügen
* PostGIS-Schema in active_schema beim ogr2ogr einbeziehen (hacky)
* nas2alb.sql: strassen.hausnr: character(8) => varchar
* ANALYZE bei Ableitungsregeln
* Fortschrittmeldung vereinheitlicht (bearbeitet => verarbeitet).
* Mehrere Lagebezeichnungen für einen Turm/ein Gebäude
* Böschungserzeugung verbessert (s. 2cf0439)
* Temporäres Verzeichnis statt temporäre Dateien verwenden
* 3_nas2alb.sql parallelisiert
  • Loading branch information
jef-n committed Dec 14, 2017
1 parent b8f5430 commit d405666
Show file tree
Hide file tree
Showing 85 changed files with 1,115 additions and 953 deletions.
Empty file removed TODO
Empty file.
3 changes: 0 additions & 3 deletions alkis-clean.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
SET client_encoding = 'UTF8';
SET search_path = :"postgis_schema", public;

-- Abbruch bei Fehlern
\set ON_ERROR_STOP

-- Stored Procedures laden
\i alkis-functions.sql

Expand Down
6 changes: 6 additions & 0 deletions alkis-compat.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* *
***************************************************************************/

\unset ON_ERROR_STOP
\unset ECHO

SET search_path = public;

CREATE FUNCTION unnest(anyarray) RETURNS SETOF anyelement AS $$
Expand Down Expand Up @@ -421,3 +424,6 @@ BEGIN
RETURN res;
END;
$$ LANGUAGE plpgsql IMMUTABLE;

\set ON_ERROR_STOP
\set ECHO errors
27 changes: 23 additions & 4 deletions alkis-functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ CREATE FUNCTION pg_temp.alkis_set_schema(t TEXT) RETURNS varchar AS $$
DECLARE
i integer;
BEGIN
SELECT count(*) INTO i FROM pg_catalog.pg_namespace WHERE nspname=t;
IF i = 0 THEN
EXECUTE 'CREATE SCHEMA '|| quote_ident(t);
BEGIN
EXECUTE 'CREATE SCHEMA ' || quote_ident(t);
RAISE NOTICE 'Schema % angelegt.', t;
END IF;
EXCEPTION WHEN duplicate_schema OR unique_violation THEN
-- skip
END;

PERFORM set_config('search_path', quote_ident(t) || ', ' || current_setting('search_path'), false);

Expand Down Expand Up @@ -16457,6 +16458,24 @@ Erholung von Reisenden.'),
COMMENT ON TABLE po_labels IS 'BASE: Beschriftungsobjekte';

UPDATE alkis_po_version SET version=2;
END IF;

IF ver<3 THEN
RAISE NOTICE 'Migriere auf Schema-Version 3';

ALTER TABLE po_points DROP CONSTRAINT po_points_pkey;
ALTER TABLE po_points ADD CONSTRAINT po_points_pkey PRIMARY KEY(ogc_fid) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE po_lines DROP CONSTRAINT po_lines_pkey;
ALTER TABLE po_lines ADD CONSTRAINT po_lines_pkey PRIMARY KEY(ogc_fid) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE po_polygons DROP CONSTRAINT po_polygons_pkey;
ALTER TABLE po_polygons ADD CONSTRAINT po_polygons_pkey PRIMARY KEY(ogc_fid) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE po_labels DROP CONSTRAINT po_labels_pkey;
ALTER TABLE po_labels ADD CONSTRAINT po_labels_pkey PRIMARY KEY(ogc_fid) DEFERRABLE INITIALLY DEFERRED;

UPDATE alkis_po_version SET version=3;

r := coalesce(r||E'\n','') || 'ALKIS-PO-Schema migriert';
END IF;
Expand Down
Loading

0 comments on commit d405666

Please sign in to comment.