View Ticket
Not logged in
Ticket Hash: 1b33d171d1dea88cd14da738bdf429b423707005
Title: AddGeometryColumn missing SRID trigger
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Unable_To_Reproduce
Last Modified: 2020-08-02 11:24:00
Version Found In: 4.30a
User Comments:
anonymous added on 2019-07-26 20:54:51:

The schema results should be the same when using AddGeometryColumn vs RecoverGeometryColumn

The schema resulting from AddGeometryColumn will be missing triggers

The following triggers will be missing. all other parts of the `.schema` output are the same:

CREATE TRIGGER "ggi_geotable_LOCATION" BEFORE INSERT ON "geotable"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'geotable.LOCATION violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT geometry_type FROM geometry_columns
WHERE Lower(f_table_name) = Lower('geotable') AND Lower(f_geometry_column) = Lower('LOCATION')
AND GeometryConstraints(NEW."LOCATION", geometry_type, srid) = 1) IS NULL;
END;
CREATE TRIGGER "ggu_geotable_LOCATION" BEFORE UPDATE OF "LOCATION" ON "geotable"
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'geotable.LOCATION violates Geometry constraint [geom-type or SRID not allowed]')
WHERE (SELECT geometry_type FROM geometry_columns
WHERE Lower(f_table_name) = Lower('geotable') AND Lower(f_geometry_column) = Lower('LOCATION')
AND GeometryConstraints(NEW."LOCATION", geometry_type, srid) = 1) IS NULL;
END;
CREATE TRIGGER "tmd_geotable_LOCATION" AFTER DELETE ON "geotable"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_delete = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('geotable') AND Lower(f_geometry_column) = Lower('LOCATION');
END;
CREATE TRIGGER "tmi_geotable_LOCATION" AFTER INSERT ON "geotable"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_insert = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('geotable') AND Lower(f_geometry_column) = Lower('LOCATION');
END;
CREATE TRIGGER "tmu_geotable_LOCATION" AFTER UPDATE ON "geotable"
FOR EACH ROW BEGIN
UPDATE geometry_columns_time SET last_update = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE Lower(f_table_name) = Lower('geotable') AND Lower(f_geometry_column) = Lower('LOCATION');
END;


sandro added on 2020-08-02 11:24:00:
not confirmed: both AddGeometryColumn() and RecoverGeometryColumn() do always install exactly the same set of Triggers