comparison schema/updates/1436/02.axis_no_intersecting_validity.sql @ 5141:722b7c305319

Prevent equal axis geometries with intersecting validity Such things usually cannot happen via importing, but it is at least consistent with constraints on other tables and the functionality is needed for fairway dimensions, since they are first stored in the staging area and equal geometries with intersecting validity could be generated by a concurrent import. Set the CONSTRAINT TRIGGER as INITIALLY DEFERRED because new entries are inserted before the validity of existing entries is adapted in the same transaction.
author Tom Gottfried <tom@intevation.de>
date Tue, 31 Mar 2020 12:50:30 +0200
parents
children
comparison
equal deleted inserted replaced
5140:11c4c5b8041c 5141:722b7c305319
1 DROP TRIGGER waterway_axis_wtwaxs_unique ON waterway.waterway_axis;
2
3 CREATE CONSTRAINT TRIGGER waterway_axis_wtwaxs_unique
4 AFTER INSERT OR UPDATE OF wtwaxs, validity ON waterway.waterway_axis
5 DEFERRABLE INITIALLY DEFERRED
6 FOR EACH ROW
7 EXECUTE FUNCTION prevent_st_equals('wtwaxs', 'validity WITH &&');