-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Errors: SUCCESS: 6 attribute(s) added. ERROR: field with index 4 is not the same!" when adding columns to vectors #17248
Comments
Author Name: Matthias Kuhn (@m-kuhn) This is related to definitions of field types in the QGIS provider implementation which do not match the field type which is created by the driver in the background. Therefore it is essentially to have a list of affected providers / field type pairs. OGR Provider : Date is fixed in d758340 |
Author Name: Giovanni Manghi (@gioman) For what it can matter I noticed that on a postgis layer there is no error just when adding "numeric" and "decimal" fields (cannot test real and double because of #17247) and it gives the error when choosing any other type. In my opinion among the list of blockers this issue is the really important one as it is a regression of a pretty basic (q)qgis function. Any chance to have this fixed (in time)? thanks in advance |
Author Name: Giovanni Manghi (@gioman) Giovanni Manghi wrote:
on SL the error shows when adding integer/double column types, but not "text". |
Author Name: Matthias Kuhn (@m-kuhn) 2f2e088 solves this partially The other half of the problem is, that the [qgis] spatialite provider indicates, that you can define length and precision of these fields between 0 and 20, while sqlite does in fact not support this. Therefore afterwards any column will have a default length (0) and default precision (0) assigned. I would propose to remove the option to define these (useless) options from the spatialite drivers. For now: As long as you don't change them (i.e. leave them set to 0) you should not get any warnings. |
Author Name: Giovanni Manghi (@gioman) Hi Matthias
In SL I get the error also when creating integer fields even when leaving 0 as width, does the above patch fix this case? Thanks! |
Author Name: Matthias Kuhn (@m-kuhn) Giovanni Manghi wrote:
Exactly |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
sweet. I guess that fixing postgresql is a different beast(?). thanks again. |
Author Name: Matthias Kuhn (@m-kuhn) Fixed the trivial ones in a9c05d7 Remaining problems are:
Giovanni, could you also test the other providers, that the changes did not introduce any errors which have been masqueraded by the add attribute dialog behavior before. Thank you very much. |
Author Name: Giovanni Manghi (@gioman)
Hi Matthias, for the moment I re-tested postgis, SL and shapes. Postgis: SL: SHP: |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Matthias Kuhn (@m-kuhn) Fixed the spatialite problems in 249526b No other value than 0 is allowed for integer and real columns. |
Author Name: Matthias Kuhn (@m-kuhn) I was hesitating to backport this to the 2.0 fixes but if there is demand, I can do so. The task itself is easy. |
Author Name: Matthias Kuhn (@m-kuhn) Is this still an issue? Looking at my earlier comments, I didn't take care of this one: "Postgres: Field length and precision are not correctly read from the database. (For char type with configurable length)" Can somebody confirm this (or are there others affected)
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
when I try to add a "char" column on a PostGIS layer, on save I get Could not commit changes to layer sele Errors: SUCCESS: 1 attribute(s) added. |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman) Giovanni Manghi wrote:
PostGIS: still getting error when saving a newly created char column, example Could not commit changes to layer evora Errors: SUCCESS: 1 attribute(s) added. after discarding the edits the column seems that can be updated without errors |
Author Name: Giovanni Manghi (@gioman) Giovanni Manghi wrote:
a recent commit by Jürgen has fixed this.
|
Author Name: Giovanni Manghi (@gioman) I have seen this again, on master, working on a shapefile Errors: SUCCESS: 1 attribute(s) added. ERROR: field with index 8 is not the same!
|
Author Name: Jürgen Fischer (@jef-n) Giovanni Manghi wrote:
And which types did you use? |
Author Name: Giovanni Manghi (@gioman)
will try to replicate again and let you know. |
Author Name: Giovanni Manghi (@gioman)
just got it when after adding an integer column to a point file, and filling it with field calculator and the rand function. |
Author Name: Giovanni Manghi (@gioman) and just seen this on a PostGIS layer, with QGIS master Errors: SUCCESS: 1 attribute(s) added. ERROR: the count of fields is incorrect after addition/removal of fields! |
Author Name: Matthias Kuhn (@m-kuhn) When updating this issue, please provide details not only about the provider, but also the data type you used, this considerably increases the chances of having the issue fixed ;-) |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
Hi Matthias, will do it. Anyway I have already done it (sometimes), see for example in #17248 (comment) cheers! PS |
Author Name: Jürgen Fischer (@jef-n) Giovanni Manghi wrote:
Well, the problem is the mapping between QgsField (name, type, precision) to a provider specific type on creationg of the field and the retrieval of field definitions from a provider and their mapping back to QgsField. After the field is created, the provider retrieves the new field definitions and checks it the QgsField created from that, matches what you originally entered. A mismatch produces the error message. For instance the postgres provider didn't care to retrieve the length of character fields and therefore each character field with a given length constraint would produce that error - because the provider wouldn't reflect the length constraint in the QgsField it reported (and in turn not limit edit widget in forms to that given length later and lead to a commit error if the user entered a value exceeding that length). That's what the related commit above fixes. The spatialite fix however removes the ability to specify a length constraint for float and integer field in spatialite databases as spatialite would ignore and drop constraint anyway and lead to the same error message - although it's actually a different problem. With other types and/or providers there might be other different mismatches (the name might change case or be truncated to a certain length, types might change (eg. when a integer width exceeds some limit, it might be turned into a real type). So to reproduce we need to know what combination was actually used (point file and integer doesn't really cut it ;)). But reporting and fixing another combination that produces this error wouldn't 'fix' this ticket. Maybe we should close it in favor of individual tickets for each failing combination we find. |
Author Name: Matthias Kuhn (@m-kuhn) maybe we should put some more details into the log containing dumps of the specified and provider reported field definitions, so there is a bit more information about what failed. |
Author Name: Giovanni Manghi (@gioman) It is a few days now that I don't see anymore this kind of messages, before it was quite common. Maybe we can lower the priority of this ticket?
|
Author Name: Jürgen Fischer (@jef-n) Giovanni Manghi wrote:
As said to me this are individual issues - although there is always the same error message popping up. So I close this and open new ones when a new combinations where creation and retrieval of types disagree is identified. |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
Original Redmine Issue: 8481
Affected QGIS version: master
Redmine category:vectors
Add a column in a PostGIS or Spatialite vector (or Shapefile, but does not seems to happen always in this case), then toggle editing to save edits.
The new status bar will pop up, and if you go read the message you will see something like
@errors: SUCCESS: 6 attribute(s) added. ERROR: field with index 4 is not the same!@
The edit is usually successful anyway, sometimes it is needed to toggle editing again.
The text was updated successfully, but these errors were encountered: