Opened 9 years ago
Closed 9 years ago
#2819 closed defect (fixed)
v.db.renamecolumn mysql error
Reported by: | fpouw | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.3 |
Component: | Database | Version: | 7.0.2 |
Keywords: | rename column mysql | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
The SQL in the v.db.renamecolumn package is not correct for mysql
Adding the following elif command to the "#some tricks" section enables renaming (at least for varchar column type. I didn't test it for other types)
elif driver in mysql:
if oldcoltype.upper() == "CHARACTER":
newcoltype = "varchar(%s)" % (oldcollength)
else:
newcoltype = oldcoltype
sql = "ALTER TABLE %s CHANGE %s %s %s" % (table, oldcol, newcol, newcoltype) grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
Attachments (1)
Change History (4)
by , 9 years ago
Attachment: | v.db.renamecolumn.diff added |
---|
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Backported in r67360. Closing ticket.
Note:
See TracTickets
for help on using tickets.
proposed mysql fix as diff