On Wed, 11 Jan 2023 06:00:12 -0800 (PST), Luís wrote:
> Dear Sandro,
>
> thank you for the swift reply. This morning I understood that
> restriction to apply only with the second version of the function
> (more parameters). The HTML could perhaps be built in a more explicit
> structure.
>
as a general rule all SQL functions involving reading or writing
some external file are always considered potentially harmful and
are consequently subject to SPATIALITE_SECURITY
A different error message could also help the user in this
> case. Say, something like "Current security settings do not allow the
> function to execute."
>
note: the error message is raised by SQLite, not by SpatiaLite, and
SQLite can't have any idea about extended functions if they are not
explicitly defined and enabled.
SQLite only knows that you are trying to execute an undefined function.
> With the SPATIALITE_SECURITY variable set the function still fails,
> but now with a different error message (log below). Is it still
> related to security?
>
no, this is genuire functional error.
> sqlite> SELECT ImportGeoJSON('diamond.geojson', 'diamond');
> AddGeometryColumn() error: unexpected metadata layout
>
this means that your DB lacks all the metadata tables specifically
required by SpatiaLite (as geometry_columns and friends)
so it's impossibile to create a Geometry column.
> GeoJSON import: INSERT INTO error (table diamond has 2 columns but 3
> values were supplied)
>
and consequently the INSERT then fails just because of the
previous error.
Hint:
-------------------------------------
Every time you create a new DB you must always create all the
tables required by SpatiaLite.
SELECT InitSpatialMetaDataFull(1);
note: this is not required when using the GUI tool, but is
strictly mandatory when using CLI interfaces.
bye Sandro