3liz / qgis-veloroutes_voies_vertes-plugin

Standard Covadis Véloroutes et Voies Vertes (3V)
4 stars 5 forks source link

Migration to 0.5.0 might be broken #91

Closed Gustry closed 3 years ago

Gustry commented 3 years ago

In the file 30_VIEW.sql

CREATE VIEW veloroutes.v_portion AS
 SELECT v_port_geom.collect_geom AS geom,
    portion.id_portion,
    portion.nom,
    portion.description,
    portion.type_portion,
    portion.id_on3v,
    portion.id_local,
    portion.mont_subv,
    portion.annee_subv
   FROM (veloroutes.portion
     JOIN veloroutes.v_port_geom ON ((portion.id_portion = v_port_geom.id_portion)));

In the latest migration to 0.5.0 :

CREATE OR REPLACE VIEW veloroutes.v_portion AS
 SELECT st_setsrid(st_geomfromtext('LINESTRING(0 0, 0 0)'), 2154) AS geom,
        0 AS id_portion, '' AS nom, '' AS description, 'ETP' AS type_portion,
        '' AS id_on3v, '' AS id_local, 0.0 AS mont_subv, '' AS annee_subv
 WHERE (SELECT COUNT(*) FROM veloroutes.v_port_geom) = 0
 UNION ALL
 SELECT v_port_geom.collect_geom AS geom,
    portion.id_portion,
    portion.nom,
    portion.description,
    portion.type_portion,
    portion.id_on3v,
    portion.id_local,
    portion.mont_subv,
    portion.annee_subv
   FROM veloroutes.portion
     JOIN veloroutes.v_port_geom ON portion.id_portion = v_port_geom.id_portion;

So the code for the same given view is not the same.

I would need to investigate why the "test migration" is ok ...

A fresh install from the plugin works for me, so going with files 10,20,30. A migration from the database fails for me with :

returned 0 [ERROR: function st_geomfromtext(unknown) does not exist
LINE 22: SELECT st_setsrid(st_geomfromtext('LINESTRING(0 0, 0 0)'), ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
]
Execution failed after 0.25 seconds

Which seems indeed linked to the migration.

The result is also different if I run the twice the algorithm and there isn't BEGIN; COMMITS; in the migration.

Gustry commented 3 years ago

Ok, related to search_path. Fixed with 82e024aef855ef2ae6b891c9d55e84c1160ac192