<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div dir="ltr" id="yui_3_16_0_1_1419893908255_138412"><span>David,</span></div><div id="yui_3_16_0_1_1419893908255_139084" dir="ltr"><br><span></span></div><div id="yui_3_16_0_1_1419893908255_139086" dir="ltr"><span id="yui_3_16_0_1_1419893908255_139085">Given your data is managed in Postgres, what you are doing seems (from my limited understanding) to contravene good data management practice. It is more a data management than (Q)GIS operation.<br></span></div><div id="yui_3_16_0_1_1419893908255_139093" dir="ltr"><br><span></span></div><div id="yui_3_16_0_1_1419893908255_139090" dir="ltr"><span id="yui_3_16_0_1_1419893908255_139089">Ideally you never replicate records in a database - this leads to data inconsistencies and update/maintenance problems. The approach generally used (apart from data warehousing cases) is to use views to create virtual tables, so your selects (which do not require QGIS to make - just to visualise) can be applied to create a view on your source table containing the desired records.</span></div><div id="yui_3_16_0_1_1419893908255_140701" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1419893908255_140703" dir="ltr"><span id="yui_3_16_0_1_1419893908255_140702">You could wrap this functionality up in a script (language of your choice) to facilitate the creation & modification of such views, such as the addition of new records to an existing view - either by extending the where clause, or adding new record using "union".  A stored QGIS project opening such views as layers will automatically pick up any changes made which impact on the view contents.</span></div><div id="yui_3_16_0_1_1419893908255_140715" dir="ltr"><br><span></span></div><div id="yui_3_16_0_1_1419893908255_140716" dir="ltr">Cheers<br><span></span></div><div id="yui_3_16_0_1_1419893908255_140717" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1419893908255_140719" dir="ltr"><span id="yui_3_16_0_1_1419893908255_140718">Brent Wood</span></div><br>  <div id="yui_3_16_0_1_1419893908255_138403" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1419893908255_138402" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1419893908255_138401" dir="ltr"> <hr id="yui_3_16_0_1_1419893908255_138439" size="1">  <font id="yui_3_16_0_1_1419893908255_138410" size="2" face="Arial"> <b id="yui_3_16_0_1_1419893908255_140721"><span id="yui_3_16_0_1_1419893908255_140720" style="font-weight:bold;">From:</span></b> Jan Michálek <godzilalalala@gmail.com><br> <b id="yui_3_16_0_1_1419893908255_140723"><span id="yui_3_16_0_1_1419893908255_140722" style="font-weight: bold;">To:</span></b> David Kramer <davidk@gmail.com> <br><b id="yui_3_16_0_1_1419893908255_140725"><span id="yui_3_16_0_1_1419893908255_140724" style="font-weight: bold;">Cc:</span></b> qgis-user <qgis-user@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, December 31, 2014 2:24 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Qgis-user] Storing data to postgis from Qgis<br> </font> </div> <div class="y_msg_container"><br><div id="yiv9306796664"><div><div dir="ltr">In db manager you can import data in new table or add features to an existing table.<br clear="none">Or you can add empty column to a table, select in qgis desktop, open atribute table, display selected features on top and edit empty column by your atributes.<br clear="none"></div><div class="yiv9306796664gmail_extra"><br clear="none"><div class="yiv9306796664gmail_quote">2014-12-30 6:10 GMT+01:00 David Kramer <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:davidk@gmail.com" target="_blank" href="mailto:davidk@gmail.com">davidk@gmail.com</a>></span>:<br clear="none"><div class="qtdSeparateBR"><br><br></div><div class="yiv9306796664yqt5298114081" id="yiv9306796664yqt23190"><blockquote class="yiv9306796664gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div class="yiv9306796664gmail_extra">Leknin, </div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">Thanks for the reply. I've followed your recipe and indeed I can paste my selected features as a new memory layer (thanks Jan) and then import the layer via db manager into postgis. This is tremendously useful, but is not quite what I'm looking for.</div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">I don't really want to create a new table, I really want to just select a few fields out of my newly selected layer and save those as a row in an already created table. For example, let's assume I have a table that lists franchises the states that they do business in and the columns:</div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">'Franchise Name'    |  'States'             | 'geom'</div><div class="yiv9306796664gmail_extra">===================================</div><div class="yiv9306796664gmail_extra">Alice's Restaurant   | "NY, NJ, PA"    |   ...<br clear="none"></div><div class="yiv9306796664gmail_extra">Joe's Burgers          |  "CA, NV, OR"  |   ...</div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">To add a new row to the table I'd like to go into qgis, select the states for a franchise (from a layer of states), save that as a memory layer. Then I'd like to have a save function which allows me to enter the franchise name. It would save only the name, the states and the geometry as a row in the table. </div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">Make sense? Is this possible from the GUI or do I need to write a plugin in pyQGIS?</div><div class="yiv9306796664gmail_extra"><br clear="none"></div><div class="yiv9306796664gmail_extra">Thx</div><span class="yiv9306796664HOEnZb"><font color="#888888"></font></span><div class="yiv9306796664gmail_extra">David</div></div>
</blockquote></div></div><br clear="none"></div></div></div><br><div class="yqt5298114081" id="yqt69818">_______________________________________________<br clear="none">Qgis-user mailing list<br clear="none"><a shape="rect" ymailto="mailto:Qgis-user@lists.osgeo.org" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br clear="none"><a shape="rect" href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></div><br><br></div> </div> </div>  </div></body></html>