On Sun, 1 Oct 2023 09:59:02 -0700 (PDT), Joshua Lugo Mclellan wrote:
> Hi,
>
> Unfortunately I keep running into
> "Parse error: unsafe use of GeometryConstraints()"
> errors and I'm not sure> how to do it correctly. Most recently I
> tried using
> the virtual table to get well known text representation of the geo
>
Hi Joshua,
you are most likely experiencing the same effects described
in this fairly recent ticket:
https://www.gaia-gis.it/fossil/libspatialite/tktview?name=d8b5703db6
a very quick explanation:
1. A few years ago SQLite introduced PRAGMA trusted_schema, a directive
intended to improve security
2. when trusted_schema=1 SQLite forbids all the following operations:
2.a) using SQL functions defined by any loadable extension in the
context of VIEWs and TRIGGERs
2.b) using VirtualTables
unfortunately SpatiaLite is entirely based on the extensive use of
extra SQL functions which are continuously called by Triggers.
in short: when trusted_schema=1 SpatiaLite completely stops working.
usally all the most common SQLite distributions still continue to be
compiled in such a way as to keep trusted_schema=0, and so everything
continues to work as always.
in recent times, however, it seems that some distributions have
started to adopt the opposite choice (i.e. trusted_schema=1)
I suspect it's a problem especially in the Mac world, but it's
just a suspicion.
the simplest solution: try running this command every time you
open a connection to a DB
PRAGMA trusted_schema=0
this will immediately restore SQLite to its "traditional/historical"
mode and SpatiaLite will restart working as expected.
bye Sandro