Opened 13 years ago
Last modified 5 years ago
#1393 new defect
v.db.join and "duplicate column name"
Reported by: | lucadelu | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 7.8.3 |
Component: | Vector | Version: | unspecified |
Keywords: | vector db join | Cc: | |
CPU: | Unspecified | Platform: | All |
Description
Today I found a problem when I try to join tables with v.db.join. The problem was that the key columns have the same name and the join returned an error.
v.db.join map=confini_provinciali column=PROV otable=tabprovince ocol=PROV DBMI-SQLite driver error: Error in sqlite3_prepare(): duplicate column name: PROV ERROR: Error while executing: 'ALTER TABLE confini_provinciali ADD COLUMN PROV CHARACTER ' ERROR: Cannot continue (problem adding column). ERROR: Cannot continue.
To solve this problem I adding two flag that they permit to pass it. One permit to not copy the join column, the data of join column are already present on the map table; the other flag permit to copy all the column from other_table adding "_o" to the columns name. This is the idea used by v.overlay that add "_a" at the columns of ainput and "_b" for the columns of binput. In attachment you can found the patch, test it and if you think that it's a good solution please add it to the svn
Attachments (2)
Change History (9)
by , 13 years ago
Attachment: | vdbjoin.patch added |
---|
comment:1 by , 9 years ago
Milestone: | 6.4.2 → 6.4.6 |
---|
comment:2 by , 6 years ago
I'm attaching a patch to the current Python version of v.db.join that does the following:
- add a 'column_prefix' parameter that allows defining a column prefix for all newly joined columns in order to avoid any column name conflicts
- never join the key column from the other table as that would be redundant
Any objections against applying this ?
by , 6 years ago
Attachment: | v_db_join_colprefix.diff added |
---|
comment:3 by , 6 years ago
Milestone: | 6.4.6 → 7.8.0 |
---|
comment:7 by , 5 years ago
Milestone: | → 7.8.3 |
---|
sorry the patch before was wrong