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
[Bug]: reserved SQL word as an attribute table column name causes multiple failures #3615
Comments
I tested importing and it works just fine. Attribute table is created and I am able to query it from GUI. Still it is not the only place where column names are not quoted properly thus e.g. opening an attribute table will fail. I expect other tools to fail too. |
So you propose to change these names, in that case all will be working fine? |
GRASS does not use secure SQL code (quoted column/table names, parameterized SQL expressions) thus column/table names being SQL keywords ("ORDER" in your case) will cause failures. We have made first attempts at improving things but it will take long time (if ever) to fix all problematical places. |
See also: https://trac.osgeo.org/grass/ticket/3071 |
Renaming and lowering letters doesn't help at all. I delete the file, then I try again with command:
Then I try to forcely delete basin vector from linux terminal and rerun the program: the basin is imported, but
here we are - the table is broken, this means that the file wasn't imported correctly. Problem still is existing. |
I also don't understand how the file can exist befor is was imported. Seems that some traces of table in the database exist and db.tables command doesn't see them. |
So, what's wrong with my command or with my file basin2.shp? Why it isn't imported even while columns names are changed? |
I tried with lower case. It doesn't help. And also I deleted location and recreated it. All the same. |
Per design. Table names are not required to match map names. |
@geografin after you successfully import your shapefile into GRASS GIS database, rename vector map table columns which names are DB reserved keywords with db.execute (v.db.renamecolumn module is actually not working or GUI tool) module, please. example of renaming ORDER column to renamed column name:
|
You are holding it wrong (a.k.a. I can not reproduce the issue):
|
I really don't understand now. Because if I open GUI db.tables gives 'HydroLAKES_polys_v10', from Linux the same Location - db.tables give 'basin' |
Sorry. The only problem here there was the following: |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Importing files shouldn't break database connections.
Screenshots
If applicable, add screenshots to help explain your problem.
System description (please complete the following information):
Additional context
As mentioned in #3604 GUI can't really open attribute table correctly, as reserved names of columns exist, so the last commit doesn't solve the problem of importing files too.
in database browser I see that no tables there are in the database.
When I try to add a table in GUI I get "ERROR: There is already a table linked to layer <1>"
The text was updated successfully, but these errors were encountered: