My problem is loading view table from Postgres.

Here is my view table:

SELECT h1.gid, h1.st_buffer
   FROM vmo_buffer_2m h1
   LEFT JOIN vodomjeri h2 ON st_intersects(h1.st_buffer, h2.geom)
  WHERE h2.gid IS NULL;

and that works normally in qgis.

When change last row with: WHERE h2.gid IS NOT NULL; I can see sql query normally with results in pgAdmin, but adding this view table in qgis show error: (st_buffer) sql= is an invalid layer and cannot be loaded.


Hi LEFT JOIN may creates doubles, and gid must be unique for QGIS to handle it as a valid layer. Could you try with a LEFT OUTER JOIN? Régis

  • When add LEFT OUTER JOIN it alwaws show LEFT JOIN (automatic add from postgre). Cant write OUOTER...
    – brunci
    Nov 18 '13 at 11:44

It could by a problem in rows where vodomjeri's gid is not null. Probably it will by a problem with geometries. Could you test validity of geometry by *ST_IsValid* Postgis function. It could be a reason why result of st_intersects is invalid for QGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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