Removed update trigger on osm_boundary_polygon (#1697)

Removed update trigger on osm_boundary_polygon, which attempted to run `REFRESH MATERIALIZED VIEW` on the table `osm_boundary_polygon_gen_z5`, resulting in the error: "osm_boundary_polygon_gen_z5" is not a materialized view
pull/1689/head^2
PatrikSylve 2024-12-17 07:44:50 +01:00 zatwierdzone przez GitHub
rodzic e6a6fb9453
commit 4ed70ba4af
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 0 dodań i 51 usunięć

Wyświetl plik

@ -29,8 +29,6 @@ DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z8;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z7;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z6;
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z5;
DROP TRIGGER IF EXISTS trigger_flag ON osm_boundary_polygon;
DROP TRIGGER IF EXISTS trigger_refresh ON boundary_polygon.updates;
-- etldoc: osm_boundary_polygon -> osm_boundary_polygon
-- etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z13
@ -100,42 +98,6 @@ CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_bou
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z6_point_geom_idx ON osm_boundary_polygon_gen_z6 USING gist (geometry_point);
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z5_point_geom_idx ON osm_boundary_polygon_gen_z5 USING gist (geometry_point);
CREATE SCHEMA IF NOT EXISTS boundary_polygon;
CREATE TABLE IF NOT EXISTS boundary_polygon.updates
(
id serial PRIMARY KEY,
t text,
UNIQUE (t)
);
CREATE OR REPLACE FUNCTION boundary_polygon.flag() RETURNS trigger AS
$$
BEGIN
INSERT INTO boundary_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION boundary_polygon.refresh() RETURNS trigger AS
$$
DECLARE
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
BEGIN
RAISE LOG 'Refresh boundary_polygon';
-- Analyze tracking and source tables before performing update
ANALYZE osm_boundary_polygon_gen_z5;
REFRESH MATERIALIZED VIEW osm_boundary_polygon_gen_z5;
-- noinspection SqlWithoutWhere
DELETE FROM boundary_polygon.updates;
RAISE LOG 'Refresh boundary_polygon done in %', age(clock_timestamp(), t);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon_row()
RETURNS trigger
AS
@ -206,16 +168,3 @@ CREATE TRIGGER update_row
ON osm_boundary_polygon_gen_z5
FOR EACH ROW
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
CREATE TRIGGER trigger_flag
AFTER INSERT OR UPDATE OR DELETE
ON osm_boundary_polygon
FOR EACH STATEMENT
EXECUTE PROCEDURE boundary_polygon.flag();
CREATE CONSTRAINT TRIGGER trigger_refresh
AFTER INSERT
ON boundary_polygon.updates
INITIALLY DEFERRED
FOR EACH ROW
EXECUTE PROCEDURE boundary_polygon.refresh();