<div dir="ltr">Hi !<div><br></div><div>I have a database where I need to be able to run post-processing queries after inserts/updates/deletes.</div><div><br></div><div>Up to now, I was doing this using postgres triggers, but I need to do it in a more flexible way (I must be able to enable/disable the postprocessing depending on user and clients preferences, and even be able to trigger it on demand).</div><div><br></div><div><br></div><div>I'm able to run SQL queries after inserts using this signal : </div><font face="monospace, monospace"><span style="background-color:rgb(204,204,204)">QgsVectorLayer.committedFeaturesAdded(layerId, addedFeature</span>s)</font><div><br></div><div>The problem is that the <font face="monospace, monospace" style="background-color:rgb(204,204,204)">addedFeatures</font> array contains the features in their state BEFORE they were committed.</div><div>This means they have no ID assigned yet (since the ID is assigned by postgres), and thus I'm not able to do my postprocessing specificaly on those features.</div><div><br></div><div>Is there a way to achieve this ?</div><div>Things like <span style="background-color:rgb(204,204,204)"><font face="monospace, monospace">lastInsertId()</font></span> probably won't work since in most case several features are commited at once.</div><div>I can only think of some ugly methods, like having a column with a "postprocessing_todo" flag.</div><div><br></div><div><div>Actually, a great thing would be to have the <span style="font-family:monospace,monospace"><span style="background-color:rgb(204,204,204)">committedFeaturesAdded</span> </span>signal<font face="monospace, monospace"> </font>return an array of database generated ids, which is easy to get (at least in postgres) using this syntax :</div><div><font face="monospace, monospace" style="background-color:rgb(204,204,204)">INSERT INTO <table> (<fields>) VALUES (<values>) RETURNING <id field></font></div></div><div><br></div><div>Any help would be much appreciated ;)</div><div><br></div><div>Bests,</div><div><br></div><div>Olivier</div></div>