Project

General

Profile

« Previous | Next » 

Revision 10110

bugfix: schemas/util.sql: mk_map_table(): add trigger to remove metadata value entries from the map spreadsheet as it's being imported, since these do not correspond to actual columns in the staging table and will produce an error when trying to rename nonexistent columns to them. note that these entries will still need to be included properly in VegBIEN.csv, which will require changes to the VegBIEN.csv make target.

View differences:

schemas/util.sql
796 796

  
797 797

  
798 798
--
799
-- Name: map_filter_insert(); Type: FUNCTION; Schema: util; Owner: -
800
--
801

  
802
CREATE FUNCTION map_filter_insert() RETURNS trigger
803
    LANGUAGE plpgsql
804
    AS $$
805
BEGIN
806
	IF new."from" LIKE ':%' THEN RETURN NULL; END IF; -- exclude metadata values
807
	RETURN new;
808
END;
809
$$;
810

  
811

  
812
--
799 813
-- Name: map_get(regclass, text); Type: FUNCTION; Schema: util; Owner: -
800 814
--
801 815

  
......
883 897
CREATE TABLE $$||$1||$$
884 898
(
885 899
    LIKE util.map INCLUDING ALL
886
)
900
);
901

  
902
CREATE TRIGGER map_filter_insert
903
  BEFORE INSERT
904
  ON $$||$1||$$
905
  FOR EACH ROW
906
  EXECUTE PROCEDURE util.map_filter_insert();
887 907
$$)
888 908
$_$;
889 909

  
......
1289 1309

  
1290 1310

  
1291 1311
--
1312
-- Name: map_filter_insert; Type: TRIGGER; Schema: util; Owner: -
1313
--
1314

  
1315
CREATE TRIGGER map_filter_insert BEFORE INSERT ON map FOR EACH ROW EXECUTE PROCEDURE map_filter_insert();
1316

  
1317

  
1318
--
1292 1319
-- PostgreSQL database dump complete
1293 1320
--
1294 1321

  

Also available in: Unified diff