Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a PostgreSQL table and view:

     CREATE TABLE lines (
      geom geometry(MultiLineString,4326),
      type character varying(254),
      login text,
      gid serial NOT NULL,
      CONSTRAINT lines_pkey PRIMARY KEY (gid))

    CREATE OR REPLACE VIEW lines_view AS 
     SELECT lines.geom,
        lines.type,
        lines.gid
       FROM lines;

    CREATE OR REPLACE RULE add AS
        ON INSERT TO lines_view DO INSTEAD  INSERT INTO lines (geom, type, login)
      VALUES (new.geom, new.type, "current_user"());

    CREATE OR REPLACE RULE del AS
        ON DELETE TO lines_view DO INSTEAD  DELETE FROM lines
        WHERE lines.login = "current_user"()::text AND lines.gid = old.gid;

     CREATE OR REPLACE RULE upd AS
      ON UPDATE TO lines_view DO INSTEAD  UPDATE lines SET geom = new.geom, type = new.type, login = "current_user"()
      WHERE lines.login = "current_user"()::text AND lines.gid = new.gid;

So, problem is when I load this lines_view in QGIS as layer and add lines, after saving I cannot use "node tool" to new lines ("Node tool: could not snap to a segment on the current layer"). But when I use move tool on them (just select "move feature(s)" button and click on new line) "node tool" start working as usual. Can some one help me with this?

share|improve this question
    
are you trying to edit a view? –  mapBaker 1 hour ago

1 Answer 1

You didn't mention qgis nor postgis version, qgis 2.10 doesn't let you edit table without a primary key - which would be the case of your view.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.