[Qgis-user] can't editing view using rules
Karl-Magnus Jönsson
Karl-Magnus.Jonsson at kristianstad.se
Sun Jan 15 22:56:25 PST 2017
Hi!
Are you sure it isn’t an issue with the view? I have a view with rules and it work in 2.18. When you have conditions in the rule you must have another rule on the same event that is unconditional. Check the last paragraph in the description : https://www.postgresql.org/docs/current/static/sql-createrule.html
In my case I have a unconditional rule that does nothing:
CREATE OR REPLACE RULE v_prislistor_upd_ins AS
ON UPDATE TO park.v_prislistor
WHERE old.id IS NULL DO INSTEAD INSERT INTO park.priser (kod, pris, utforare)
VALUES (new.kod, new.pris, new.utforare);
CREATE OR REPLACE RULE v_prislistor_upd_nothing AS
ON UPDATE TO park.v_prislistor DO INSTEAD NOTHING;
CREATE OR REPLACE RULE v_prislistor_upd_upd AS
ON UPDATE TO park.v_prislistor
WHERE old.id IS NOT NULL DO INSTEAD UPDATE park.priser SET pris = new.pris
WHERE priser.id = old.id;
Karl-Magnus Jönsson
Från: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] För Luca Lanteri
Skickat: den 13 januari 2017 16:39
Till: qgis-user
Ämne: [Qgis-user] can't editing view using rules
Hi to all,
starting fron QIS 2.16 I can't edit anymore postgres views with rules. When I try to insert a new feature I have this error [0]. All works fine with QGIS 2.14
Can anyone confirm the issue ?
Thanks
Luca
[0]
Impossibile applicare le modifiche al vettore v_frane_pol_full
Errori: ERRORE: 1 geometria non aggiunta.
Errori della sorgente dati:
Errore PostGIS nell'aggiunta delle geometrie: ERROR: cannot perform INSERT RETURNING on relation "v_frane_pol_full"
HINT: You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170116/bab2fb26/attachment.html>
More information about the Qgis-user
mailing list