<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>
</p>
    <br>
    <div class="moz-cite-prefix">On 02.09.2017 23:34, Even Rouault
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:2008461.PqfPNMJal8@even-i700">
      <meta name="qrichtext" content="1">
      <style type="text/css">
p, li { white-space: pre-wrap; }
</style>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> Ok makes sense. Though as far as QGIS goes, is there a case where a</p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> subset query can result in duplicates?</p>
      <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Could happen. The code currently handles the possibility where subsetString() is called with a completely custom SELECT statement, so potentially doing crazy things.</p>
    </blockquote>
    Ok, so if we only do this for non-select queries, we should be safe?<br>
    <blockquote type="cite" cite="mid:2008461.PqfPNMJal8@even-i700">
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> Something like this [1] seems to fix the issue, don't know if it's the</p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> best way forward though?</p>
      <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I've left a few comments in the commit</p>
    </blockquote>
    Many thanks. I've pushed a revised version at [1]. I'm in doubt
    whether it is really worth the hassle to hide the orig_ogr_fid
    column in the fields, together with the firstFieldIsFid it looks
    like it could make things very fragile... As far as I can tell, just
    the modifications in [1] without the extra logic should be pretty
    robust.<br>
    <br>
    [1]
<a class="moz-txt-link-freetext" href="https://github.com/manisandro/QGIS/commit/82a56eaa5a48a10a1a656657cefd84b619eae3f2">https://github.com/manisandro/QGIS/commit/82a56eaa5a48a10a1a656657cefd84b619eae3f2</a><br>
    <br>
    Sandro<br>
  </body>
</html>