-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SpatiaLite 4: added attributes disappear #17595
Comments
Author Name: Josef Källgården (Josef Källgården) I tested using qgis 2.0.1 and 2.1 on windows 7 and also qgis 2.0.1 in ubuntu 12.04. |
Author Name: Matthias Kuhn (@m-kuhn) Thank you for testing Josef, I opened a bug upstream and there seems to be a problem indeed (I'm working on it). I don't know why it works in your case. Are you sure you have spatialite 4? https://groups.google.com/forum/#!topic/spatialite-users/FOq1DPRDkJw |
Author Name: Josef Källgården (Josef Källgården) Yes, I am definitely sure about using splite 4.1.1. |
Author Name: Alexander Bruy (@alexbruy) Also confirmed on QGIS 2.2 under Windows and Linux
|
Author Name: Matthias Kuhn (@m-kuhn) This is a tricky issue. Just spent a good amount of time to reproduce it. It seems not to affect every file and it seems also to work always for the first added column and only affect subsequent columns. As a workaround, I think the following SQL commands executed should work:
I would be happy to get a feedback if this workaround works for others as well. If yes, it could be implemented into the spatialite provider. |
Author Name: Alexander Bruy (@alexbruy) Just tested proposed workaround on several databases and it works fine for me. |
Author Name: Matthias Kuhn (@m-kuhn) I've got a preliminary implementation containing a workaround for spatialite <= 4.1.1 and a proper implementation for spatialite > 4.1.1. However it seems it suffers from a flaw that any new column is treated as TEXT, so no INTEGER, FLOAT or BLOB support at the moment... |
Author Name: René-Luc ReLuc (@rldhont) I confirme the bug on Ubuntu and Windows. Some one is reviewing the proposed patch ? |
Author Name: Matthias Kuhn (@m-kuhn) I think that (under certain circumstances?) spatialite determines the column type from the content. That means, as long as there is no content it cannot properly determine the column data type (and falls back to TEXT). We normally just create a new column which is then initialized with NULL values and only filled with data afterwards, so QGIS loads the new column while there are still only NULL values in there. ToDo:
|
Author Name: Regis Haubourg (@haubourg) Hi,
Spatialite is currently not usable.. Will keep testing. Régis |
Author Name: Regis Haubourg (@haubourg) Joining the sample sqlite file, I suspect something wrong inside sqlite table, since oids from postgis are the same on the lines that I can't fill with values..
|
Author Name: Regis Haubourg (@haubourg) Previous bug is probably only for our postgis 9.0 instance that is having serious trouble in system tables and oid's. |
Author Name: Jürgen Fischer (@jef-n) Regis Haubourg wrote:
Side note: "Save as" use the OGR to produce the spatialite database, while d&d in the browser would use the spatialite provider to create table table - which also is used to access the database later. Does the latter behave the same? |
Author Name: Regis Haubourg (@haubourg) with dbmanager d&d, issue of null uneditable values is not reproduced. Still my issue with source oid's remains, since now see negative oids ! (my postgres instance is dying, migration urges now. postgis 2 and pg 9.3 is not affected) |
Author Name: Regis Haubourg (@haubourg) with file datasources, I could successfully add several fields and fill them. Patch seems ok here. |
Author Name: Jürgen Fischer (@jef-n) Regis Haubourg wrote:
Another side note: I meant d&d the browser and not in dbmanager - not sure if dbmanager uses the spatialite provider or has yet another way to create databases, tables and/or insert into sl databases. |
Author Name: Matthias Kuhn (@m-kuhn) Régis, thank you for testing.
|
Author Name: Regis Haubourg (@haubourg) Reopening , readding seems ok with int and decimal, reading sqlite with ogr file or database connection gui. I have one error when creating a new int or decimal field, and trying to save before having it filled with data. The error message is strange, it seems to get the wrong field (here field 58 when i have 70 fields.)
|
Author Name: Matthias Kuhn (@m-kuhn) May that be leftovers of experiments performed with QGIS without this patch added? See #17595 (comment) for how to fix the file. |
Author Name: Hugo Mercier (@mhugo) Hi, There is still a problem when loading a corrupted sqlite file right ? (I stumbled upon this when trying to add fields to an open sqlite file from a plugin). |
Author Name: Matthias Kuhn (@m-kuhn) In loadFieldsAbstractInterface there is a PRAGMA table_info() call and a gaiaVectorLayerPtr is checked. You can refer to this discussion here https://groups.google.com/forum/#!topic/spatialite-users/FOq1DPRDkJw for some more information. |
Author Name: Micha Silver (@micha-silver) Matthias Kuhn wrote:
I can verify that the above issue, new columns disappearing in QGIS, is still a problem in 2.12. New TEXT columns seem to appear OK, but new INTEGER do not even after Matthias' workaround. |
Author Name: Jukka Rahkonen (Jukka Rahkonen) Read this discussion from the spatialite-users forum with a proposed way to fix it properly. |
Author Name: Giovanni Manghi (@gioman) Matthias, this is a lengthy thread and I have only tested after the original description. On 2.18.4 I can't see anymore the issue you described in detail. What I still see is that if I repeat the operations in order to add other columns, then on save messages like Errors: SUCCESS: 1 attribute(s) added. pop up. every time, but this does not stop the column to be saved correctly. What is the status of this issue on recent qgis releases as 2.18.4?
|
Author Name: Micha Silver (@micha-silver) I also do not see this problem any longer (Linux Mint with QGIS 2.18.4)
|
Author Name: Giovanni Manghi (@gioman) Giovanni Manghi wrote:
both the original issue and the one I reported here above seems gone in recent qgis releases.
Checking in the sqlite data itself, the column is actually added and the expression data is present. Expected behavior: Note: Caveat: Can somebody verify this behavior. I want to be sure it is not a local issue before reporting it upstream. to How to reproduce:
Checking in the sqlite data itself, the column is actually added and the expression data is present. Expected behavior: Note: Caveat: Can somebody verify this behavior. I want to be sure it is not a local issue before reporting it upstream.
|
Author Name: Matthias Kuhn (@m-kuhn)
Original Redmine Issue: 8923
Affected QGIS version: 2.2.0
Redmine category:data_provider/spatialite
How to reproduce:
Checking in the sqlite data itself, the column is actually added and the expression data is present.
Expected behavior:
The newly added column should be visible
Note:
The problems seems to be the table @geometry_columns_field_infos@ which does not contain the new column, but the spatialite provider loads the information from there. I think, that it should be updated by a trigger, but my spatialite knowledge ends pretty much there.
Caveat:
Make sure you have a more recent build than 249526b (Oct, 20) to be able to add columns
Can somebody verify this behavior. I want to be sure it is not a local issue before reporting it upstream.
Related issue(s): #17524 (relates), #18799 (duplicates)
Redmine related issue(s): 8834, 10381
The text was updated successfully, but these errors were encountered: