<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Nicolas,</p>
<p>We have similar issues in our projects. </p>
<p>It looks like a bug to me that the default value is called that many times.</p>
<p>Matthias: any comments on that? Or can you explain why this happens and how this can be potentially fixed?</p>
<p>Greetings,</p>
<p>Andreas</p>
<p>On 2016-11-08 17:50, Nicolas Boisteault wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<p>Logs confirm the issue :</p>
<p>First time form opened :</p>
<p>2016-11-08 17:45:03 CET [15733-1] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-2] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-3] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-4] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-5] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-6] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-7] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-8] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-9] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-10] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:45:03 CET [15733-11] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)</p>
<p><span>Second </span><span>time form </span><span>opened :</span></p>
<p><br />2016-11-08 17:47:10 CET [15733-48] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-49] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-50] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-51] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-52] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-53] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-54] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-55] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-56] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-57] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)<br />2016-11-08 17:47:10 CET [15733-58] user@carto LOG: statement: SELECT nextval('public.station_gid_seq'::regclass)</p>
<p>If someone can confirm this issue I'll open a ticket.</p>
<p> </p>
<p>Le 2016-11-08 17:27, Nicolas Boisteault a écrit :</p>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">
<p>What is weird is that every time I open the form it increments sequence of 11 <strong>not</strong> 1. So I guess nextval is called 11 times! I'll try to log that. I'm using QGIS 2.18.</p>
<p>Le 2016-11-08 16:35, Matthias Kuhn a écrit :</p>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">
<div class="pre" style="margin: 0; padding: 0; font-family: monospace;">Yes, every time you open a form, a new gid is retrieved (nextval is<br /> executed) what makes the counter go up very fast.<br /><br /> Another thing that could need some attention (it might have changed with<br /><a href="https://github.com/qgis/QGIS/pull/3733">https://github.com/qgis/QGIS/pull/3733</a> but I didn't check in detail).<br /><br /> Matthias<br /><br /> On 11/08/2016 04:19 PM, Nicolas Boisteault wrote:
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">Matthias,<br /><br /> Thank you for the tip.<br /><br /> It works without transactional editing.<br /><br /> I enabled it to test and I like the fact that observation layer is<br /> automatically put in editable state when I put station layer as<br /> editable. It is very convenient for users. I'll modify the foreign<br /> key constraint and will tell if it works for me.<br /><br /> Now I have an issue which is not related to transactional editing. When<br /> I create a new station the gid parameter is incremented by +11 not +1.<br /><br /> Can anyone confirm this issue? Thanks.<br /><br /> Le 2016-11-08 14:44, Matthias Kuhn a écrit :<br /><br />
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">Nicolas,<br /><br /> Sorry I forgot: you will probably also need to enable transactional<br /> editing and set the foreign key constraint check to deferred to make it<br /> work properly.<br /><br /> Regards<br /> Matthias<br /><br /> On 11/08/2016 02:08 PM, Nicolas Boisteault wrote:
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">This is perfect! Thank you very much Matthias.<br /><br /> Le 2016-11-08 12:45, Matthias Kuhn a écrit :<br /><br />
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">Go to the project properties and on the data sources tab check "evaluate<br /> default values on provider side".<br /><br /> Regards<br /> Matthias<br /><br /> On 11/08/2016 12:37 PM, Nicolas Boisteault wrote:
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">Hi Matthias Kuhn,<br /><br /> First thank you very much for your help and your work on this feature<br /> There is room for improvement but this functionality is already great<br /> as it.<br /><br /> Another question. I also tried to add a station and an observation from<br /> the station form.<br /><br /> When creating, I have 'nextval('public.station_gid_seq'::regclass)' in<br /> the gid attribute and in the id_station attribute too which is good<br /> to me.<br /><br /> Now if i save the observation feature first it won't work because the<br /> station feature it refers doesn't exist. It is logical to me.<br /><br /> But if save the new station feature, it only save this feature and not<br /> the relative observation with the newly foreign created.<br /><br /> Is it a bug or a limitation? Thanks.<br /><br /> Le 2016-11-08 12:09, Matthias Kuhn a écrit :<br /><br />
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">Hi Nicolas,<br /><br /> This is a limitation of the current implementation.<br /><br /> You can either add a new station without geometry first and then<br /> select<br /> it in the attribute table and use the add part tool to add a geometry.<br /><br /> Or add it from its own layer and then link it to the parent<br /> observation.<br /><br /> I agree there is room for improvement.<br /><br /> Regards<br /> Matthias<br /><br /> On 11/08/2016 11:49 AM, Nicolas Boisteault wrote:
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;"> <br /><br /> Hi List,<br />  <br /> I have two tables :<br /><br />   * station : gid, geom (point)<br />   * observation : id, id_station (foreign key)<br /><br /> There is a 1:N relation; for one station feature there are multiple<br /> observation features.<br /><br /> I add the relation between my two tables in QGIS -> project<br /> properties.<br /> I use the relation reference widget on id_station and check 'able the<br /> add of new entities' (not sure about my english translation)<br />  <br /> So now when I create a new observation I can click the plus symbol to<br /> add a station but I can't see how I can create the point<br /> geometry. I'm<br /> not able to click the map.<br />  <br /> Any hint? Thank you all.<br />  <br /> -- <br /><br /> Nicolas BOISTEAULT<br /><br />  <br /><br /><br /><br /> _______________________________________________<br /> Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>>>><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote>
_______________________________________________<br /> Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>><br /> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a> <mailto:<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>>>><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</div>
</blockquote>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace;">_______________________________________________<br /> Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>
</blockquote>
<!-- html ignored --><br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br /> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br /> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>
</blockquote>
<p> </p>
<div> </div>
</body></html>