NOT NULL constraint failed: views_geometry_columns.read_only:

42 views
Skip to first unread message

Kyle Felipe Vieira Roberto

unread,
Jan 19, 2018, 12:38:52 PM1/19/18
to SpatiaLite Users
Hi guys.

Im trying to create a spatialview with this code:

CREATE VIEW viwe_ponto AS 
SELECT id
 ,plantio
 ,execucao
 ,talhao
 ,espacament
 ,dataplanti
 ,area
 ,especie
 ,tecnico
 ,art
 ,identifica
 ,cnpj_cpf
 ,quanto
 ,(ST_PointOnSurface( geom )) as geom
 FROM producao_florestal;
 INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
VALUES ('viwe_ponto', 'geom', 'id', 'producao_florestal', 'geom');

but im getting the follow issue:

NOT NULL constraint failed: views_geometry_columns.read_only:

INSERT INTO views_geometry_columns

(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)

VALUES ('viwe_ponto', 'geom', 'id', 'producao_florestal', 'geom');


im already set SATIALITE_SECURITY to relaxed,

load extension...


Thx...


my S.O is UBUNTU 17.04

mj10777

unread,
Jan 19, 2018, 2:33:06 PM1/19/18
to SpatiaLite Users


On Friday, 19 January 2018 18:38:52 UTC+1, Kyle Felipe Vieira Roberto wrote:
Hi guys.

Im trying to create a spatialview with this code:

CREATE VIEW viwe_ponto AS 
SELECT id
 ,plantio
 ,execucao
 ,talhao
 ,espacament
 ,dataplanti
 ,area
 ,especie
 ,tecnico
 ,art
 ,identifica
 ,cnpj_cpf
 ,quanto
 ,(ST_PointOnSurface( geom )) as geom
For a SpatialView the given geometry must exist in the registered table.
- viwe_ponto.ST_PointOnSurface( geom ) is not the same as producao_florestal.geom
-- but a dynamically created/changed version from producao_florestal.geom
--> and will be a POINT, where as producao_florestal.geom is possible not a POINT

 FROM producao_florestal;
 INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
Here you are giving the information that 'viwe_ponto', 'geom' is stored in 'producao_florestal', 'geom'
- but that is not the case, the geometry in the view is created on the fly from  'producao_florestal', 'geom'
VALUES ('viwe_ponto', 'geom', 'id', 'producao_florestal', 'geom');

but im getting the follow issue:

NOT NULL constraint failed: views_geometry_columns.read_only:

Here you must set a value for the field 'read_only', which you have not included
(even if you did, you would not get a correct result due to the above errors.) 

INSERT INTO views_geometry_columns

(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)

VALUES ('viwe_ponto', 'geom', 'id', 'producao_florestal', 'geom');


Mark
Reply all
Reply to author
Forward
0 new messages