2017-11-10 15:21:25 +00:00
|
|
|
DROP TRIGGER IF EXISTS trigger_flag ON osm_waterway_linestring;
|
2017-07-12 14:06:15 +00:00
|
|
|
DROP TRIGGER IF EXISTS trigger_refresh ON osm_waterway_linestring;
|
|
|
|
|
|
|
|
DO $$
|
|
|
|
BEGIN
|
2017-11-10 20:28:12 +00:00
|
|
|
update osm_waterway_linestring
|
|
|
|
SET tags = update_tags(tags, geometry);
|
|
|
|
|
|
|
|
update osm_waterway_linestring_gen1
|
|
|
|
SET tags = update_tags(tags, geometry);
|
|
|
|
|
|
|
|
update osm_waterway_linestring_gen2
|
|
|
|
SET tags = update_tags(tags, geometry);
|
|
|
|
|
|
|
|
update osm_waterway_linestring_gen3
|
|
|
|
SET tags = update_tags(tags, geometry);
|
2017-07-12 14:06:15 +00:00
|
|
|
END $$;
|
|
|
|
|
|
|
|
|
|
|
|
-- Handle updates
|
|
|
|
|
|
|
|
CREATE SCHEMA IF NOT EXISTS waterway_linestring;
|
|
|
|
CREATE OR REPLACE FUNCTION waterway_linestring.refresh() RETURNS trigger AS
|
|
|
|
$BODY$
|
|
|
|
BEGIN
|
2017-11-10 14:25:23 +00:00
|
|
|
-- RAISE NOTICE 'Refresh waterway_linestring %', NEW.osm_id;
|
2017-11-10 20:28:12 +00:00
|
|
|
NEW.tags = update_tags(NEW.tags, NEW.geometry);
|
2017-07-12 14:06:15 +00:00
|
|
|
RETURN NEW;
|
|
|
|
END;
|
|
|
|
$BODY$
|
|
|
|
language plpgsql;
|
|
|
|
|
|
|
|
CREATE TRIGGER trigger_refresh
|
|
|
|
BEFORE INSERT OR UPDATE ON osm_waterway_linestring
|
|
|
|
FOR EACH ROW
|
|
|
|
EXECUTE PROCEDURE waterway_linestring.refresh();
|