https://issues.qgis.org/https://issues.qgis.org/favicon.ico2013-07-30T03:03:19ZQGIS Issue TrackingQGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437002013-07-30T03:03:19ZMatthias Kuhn
<ul><li><strong>Assignee</strong> deleted (<del><i>Matthias Kuhn</i></del>)</li></ul> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437022013-07-30T04:53:27ZMatthias Kuhn
<ul></ul>QgsFields does not accept more than one field with the same name.
<ul>
<li>If this is changed, what behavior should be expected of e.g. feat['attributeA']? To return just a random/first of the two attributes?</li>
<li>How many dataproviders do even support this? Is this a shapefile only problem?</li>
<li>Should rather be considered appending '_{nr}' to the field (e.g. 'attributeA', 'attributeA_1' etc.)</li>
</ul> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437032013-07-30T04:58:15ZNathan Woodrow
<ul></ul><p>I'm not in favour of adding any work around in the code to handle having fields with the same name. I would just say we don't support it anymore and leave it as that. In most (all) cases it doesn't make sense to have two columns with the same name and it would make working with the data hard.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437042013-07-30T05:01:19ZMatthias Kuhn
<ul></ul><p>But the current behavior is bad: opening a layer and silently half-dropping a column because it doesn't meet some silent QGIS standard.</p>
<p>I'd say we declare this a standard and defer handling to the provider level. So the Shapefile (and CSV and whatever) provider have to take care of it and provide a wrapperlevel or ask the user to rename the column...</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437052013-07-30T05:04:03ZNathan Woodrow
<ul></ul><p>At the provider level should be fine. I think it would only be the ogr provider because most of the database types don't support columns with the same name.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437062013-07-30T05:15:50ZPedro Venânciopedrongvenancio@gmail.com
<ul></ul><p>I don't know if this involves a lot of change in the code, but this would be, in my opinion, the best solution.</p>
<blockquote>
<ul>
<li>Should rather be considered appending '_{nr}' to the field (e.g. 'attributeA', 'attributeA_1' etc.)</li>
</ul>
</blockquote>
<p>If you look at the attached image, libbreoffice also make this change.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437072013-07-30T05:28:13ZPedro Venânciopedrongvenancio@gmail.com
<ul></ul><p>The problem is definitely of the data, but this behavior</p>
<blockquote>
<p>But the current behavior is bad: opening a layer and silently half-dropping a column because it doesn't meet some silent QGIS standard.</p>
</blockquote>
<p>is not good. It took me some time to realize what was the source of the problem when I tried to delete a column from the dataset attached.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437082013-07-30T05:54:27ZMatthias Kuhn
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/54140310b4878c69395895ada0b70636123b47e3" title="[ogr] Rename columns with non-unique name (Fix #8385)">54140310b4878c69395895ada0b70636123b47e3</a>.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437162013-07-30T13:09:08ZPedro Venânciopedrongvenancio@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/download/6094/corrupted_record.png">corrupted_record.png</a> added</li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>Thank you very much for the quick fix Matthias!</p>
<p>However, it seems that there are still some problems.</p>
<p>1) In the case of trying to eliminate the first column with the name repeated, while saving I get:</p>
<pre>
Could not commit changes to layer vegetacao
Errors: SUCCESS: 1 attribute(s) deleted.
ERROR: field with index 2 is not the same!
</pre>
<p>2) Eliminating any of the other columns, generates no error but corrupts the last record of the attributes table (see the image).</p>
<p>3) In the Field Calculator, if I "Load all unique values" in that first column repeated, nothing is shown. In the remaining fields, now everything works as expected, except in the second column with the name repeated, where the "Load" shows the values, but on Terminal I get "ERROR 1: Unrecognised Z83_PONTOS_1 field name in ORDER BY.".</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=437232013-07-31T23:16:06ZMatthias Kuhn
<ul><li><strong>Category</strong> changed from <i>Vectors</i> to <i>Data Provider/OGR</i></li></ul> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441072013-08-16T02:35:17ZJürgen Fischerjef@norbit.de
<ul><li><strong>Priority</strong> changed from <i>Severe/Regression</i> to <i>Normal</i></li></ul><p>I suppose the fieldname should be unique. As such it's an edge case and shouldn't be considered a blocker.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441082013-08-16T02:41:02ZPedro Venânciopedrongvenancio@gmail.com
<ul></ul><p>Hi Jurgen,</p>
<blockquote>
<p>I suppose the fieldname should be unique. As such it's an edge case and shouldn't be considered a block.</p>
</blockquote>
<p>I agree, but the most serious problem here is that the data may be corrupted.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441092013-08-16T02:41:52ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Jürgen Fischer wrote:</p>
<blockquote>
<p>I suppose the fieldname should be unique. As such it's an edge case and shouldn't be considered a blocker.</p>
</blockquote>
<p>While I agree that is an edge case I guess that the point here was that previous qgis releases handled such case in a better way. Other software also handles this case but I would not mind if qgis does not, but I guess than that such vectors should be rejected on load.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441102013-08-16T02:53:12ZJürgen Fischerjef@norbit.de
<ul></ul><p>Giovanni Manghi wrote:</p>
<blockquote>
<p>While I agree that is an edge case I guess that the point here was that previous qgis releases handled such case in a better way. Other software also handles this case but I would not mind if qgis does not, but I guess than that such vectors should be rejected on load.</p>
</blockquote>
<p>Does that mean you still consider this an very important issue? .oO(apparently I'm still not convinced that any regression how minor and "edgecasey" it might be, should be considered a blocker)</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441112013-08-16T02:54:51ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Jürgen Fischer wrote:</p>
<blockquote>
<p>Giovanni Manghi wrote:</p>
<blockquote>
<p>While I agree that is an edge case I guess that the point here was that previous qgis releases handled such case in a better way. Other software also handles this case but I would not mind if qgis does not, but I guess than that such vectors should be rejected on load.</p>
</blockquote>
<p>Does that mean you still consider this an very important issue?</p>
</blockquote>
<p>not for me</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=441122013-08-16T03:18:19ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Jürgen Fischer wrote:</p>
<blockquote>
<p>apparently I'm still not convinced that any regression how minor and "edgecasey" it might be, should be considered a blocker</p>
</blockquote>
<p>probably you are right. My point of view is that if/when possible (time, money, etc) then all regressions should be squashed, if not possible then minor/edge cases can be left open and a "know regressions" list added in the release notes.</p> QGIS Application - Bug report #8385: QGIS does not deal with shapefiles with two fields with the same namehttps://issues.qgis.org/issues/8385?journal_id=452192013-10-01T05:12:08ZMatthias Kuhn
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul><p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/54140310b4878c69395895ada0b70636123b47e3" title="[ogr] Rename columns with non-unique name (Fix #8385)">54140310b4878c69395895ada0b70636123b47e3</a>.</p>