<div dir="ltr"><div><div><div><div><div><div><div><div>I think a more global solution is possible.<br>After all when you load a postgis layer in qgis, if somebody else changes it, the view is not refreshed, which is annoying (and sometimes dangerous because you may edit old data).<br><br></div>It would be easy to ad this (which would also work for my case) using the LISTEN / NOTIFY feature of postgres.<br><br></div>Basically when selecting a table as a new qgis layer, you automatically add a triger to it.<br></div>The trigger will be fired at any change (create/delete/update). <br></div>The trigger would simply send a message to qgis via NOTIFY.<br></div><div>example : "NOTIFY qgis_change_XXXX ;", where XXXX is a unique id.<br></div><div>Of course qgis would be listening, which is very simple in python <br></div><div>(import psycopg2;<br>conn = psycopg.connect(my_database_string)<br>conn.autocommit(1)<br>curs = conn.cursor()<br>curs.execute("LISTEN qgis_change_XXXX;"))<br><br></div><div>Of course one would need a mechanism to remove this trigger when not necessary (for instance, name the channel "qgis_change_<i>time_stamp</i>",<br></div><div>delete channel too old automatically, and change channel periodically (20 in for instance)).<br></div><div><br></div>I don't know if from a security point of view it would be possibe tough (would require the permission to create a trigger).<br></div>I don't know if typical qgis user have the right to create trigger on database they use.<br><br></div>I use a lot of different version of QGIS and I can guarantee at least a dozen crash a day with version 1.8 to 2.3,<br></div><div>plus pending transaction with postgis whenever the crash occurs.<br></div><div>I'm installing 2.6 to see if postgis layers are less fragile right now ^^<br></div><div><br>Cheers,<br></div>Rémi-C<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 11:29 GMT+01:00 Martin Dobias <span dir="ltr"><<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I see - indeed QGIS would need to do quite some database inspection to understand that layer A and layer B are related. This should be however also easy to address in a custom plugin.</div><div><br></div>It is surprising to me that you say PostGIS layers are fragile in QGIS - they are very commonly used by lots of people and we haven't heard about crashes in the issue tracker. If you do experience crashes please consider filing reports on <a href="http://hub.qgis.org" target="_blank">hub.qgis.org</a> with instructions on how to replicate them.<div><div><br></div><div>Regards</div><span class="HOEnZb"><font color="#888888"><div>Martin</div><div><br></div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 19, 2015 at 5:18 PM, Rémi Cura <span dir="ltr"><<a href="mailto:remi.cura@gmail.com" target="_blank">remi.cura@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Thanks Martin,<br></div>one day to several days feel like a very reasonnable order of magnitude.<br><br></div><div>QGis is not refreshing the view because when editing layer A the postgis data base automatically also edit layer B. <br></div><div>I don't think qgis has a mechanism of tracking dbchanges (it would be possible tough).<br></div><div>Morevover PostGIS layer are still "fragile" in qgis (crashes often).<br></div><br></div><div>Thanks for the help,<br></div>Cheers<br></div>Rémi-C<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 10:56 GMT+01:00 Martin Dobias <span dir="ltr"><<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Remi<div><br></div><div>Such plugin should be quite easy to write - I would assume up to one day of work for an experienced pyqgis developer. For a newcomer it may take few more days to get familiar with the API, tools, environment and so on.</div><div><br></div><div>For the refresh of rendering after geometry editing - that should work out of the box and I would consider it a bug if it does not.</div><div><br></div><div>Regards</div><span><font color="#888888"><div>Martin</div><div><br></div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Jan 19, 2015 at 3:16 PM, Rémi Cura <span dir="ltr"><<a href="mailto:remi.cura@gmail.com" target="_blank">remi.cura@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div><div><div><div>Hello dear list.<br></div>I'm usually active on the postgis or postgres list, <br></div>but today I would like to ask a question regarding dev time.<br><br></div>In your opinion,<br></div>How much time would be needed to write a plugin for multiple versions of qgis (2.2 to current 2.6) doing 3 simple things :<br></div> - auto commit the edition of geometry when in edition mode (no need to click on save  changes each time)<br></div> - force refresh of rendering after edition of a geometry<br></div> - every camera changes (zoom or position), send a sql query containing user name and geometry of view (a rectangle in wkt for instance).<br><br></div>I can estimate this at my poor qgis-dev level, but I would like to have the timing for an expert qgis dev.<br><br></div>Many thanks,<br><br>Remi-C<br></div>
<br></div></div><span>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>