Opened 14 years ago

Closed 14 years ago

#3474 closed defect (fixed)

Spatialite Triggers

Reported by: aronrubin Owned by: Even Rouault
Priority: high Milestone: 1.7.2
Component: OGR_SF Version: 1.7.1
Severity: major Keywords: spatialite, sqlite
Cc:

Description

Spatialite triggers are not preserved across CreateField. Triggers are automatically dropped when the depended table is dropped. BTW is ALTER TABLE ADD COLUMN not used to support Sqlite <= 3.1.3?

One other method to preserve the triggers would be to save the following aside (in a OGR side buffer): SELECT sql FROM sqlite_master WHERE type IN ('trigger','index') AND tbl_name='%s' Then execute the saved statements after manually altering the table.

Another method would assume that spatialite was the only source of triggers, etc. and execute DisableSpatialIndex prior, preform manual alter, and execute CreateSpatialIndex afterward.

Of course with both methods any column constraints in the original table would still be lost but that is less of an issue if we assume CreateField will only be called on OGR managed layers. Again I assume you did not use the ALTER or sqlite3_table_column_metadata for maximum compatibility.

Change History (2)

comment:1 by Even Rouault, 14 years ago

Owner: changed from warmerdam to Even Rouault
Status: newassigned

comment:2 by Even Rouault, 14 years ago

Resolution: fixed
Status: assignedclosed

Fixed in trunk (r19188) and in branches/1.7 (r19189). Test added in r19190

Note: See TracTickets for help on using tickets.