<div dir="ltr"><p>Jürgen,</p><p>I've been able to solve my problem by adding a default value on my view (and by also forwarding the ID in the insert trigger) :<br></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="monospace, monospace">ALTER VIEW test_view ALTER COLUMN id SET DEFAULT nextval('test_id_seq');</font></blockquote><div><br></div><div>I updated the gist just in case : <a href="https://gist.github.com/olivierdalang/cad70df2d463d0b87566" target="_blank" style="font-size:12.8000001907349px">https://gist.github.com/olivierdalang/cad70df2d463d0b87566</a> </div><p>Thank you very much for your help :)</p><p>Olivier</p><p dir="ltr"><br></p><p dir="ltr"><br></p>
<div class="gmail_quote">On Mar 18, 2015 7:17 PM, "Jürgen E." <<a href="mailto:jef@norbit.de" target="_blank">jef@norbit.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Olivier,<br>
<br>
On Wed, 18. Mar 2015 at 18:40:20 +0100, Olivier Dalang wrote:<br>
> Am I doing something wrong ?<br>
<br>
Not really - just something that isn't expected.<br>
<br>
> Or is QGIS using some other way to get back the ID of a new feature ? Any<br>
> idea of what that could be ?<br>
<br>
It retrieves the default values for all attributes (which might be a call to<br>
nextval), executes them and uses the result for the insert.  So it knows<br>
the id before the insert and can update the feature with it.<br>
<br>
<br>
Jürgen<br>
<br>
--<br>
Jürgen E. Fischer           norBIT GmbH             Tel. <a href="tel:%2B49-4931-918175-31" value="+49493191817531" target="_blank">+49-4931-918175-31</a><br>
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. <a href="tel:%2B49-4931-918175-50" value="+49493191817550" target="_blank">+49-4931-918175-50</a><br>
Software Engineer           D-26506 Norden             <a href="http://www.norbit.de" target="_blank">http://www.norbit.de</a><br>
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode<br>
<br>_______________________________________________<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></blockquote></div>
</div>