Opened 6 years ago

Closed 6 years ago

#2819 closed defect (fixed)

v.db.renamecolumn mysql error

Reported by: fpouw Owned by: grass-dev@…
Priority: normal Milestone: 7.0.3
Component: Database Version: 7.0.2
Keywords: rename column mysql Cc:
CPU: x86-64 Platform: Linux


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)


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)

v.db.renamecolumn.diff (1.1 KB) - added by neteler 6 years ago.
proposed mysql fix as diff

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by neteler

Attachment: v.db.renamecolumn.diff added

proposed mysql fix as diff

comment:1 Changed 6 years ago by neteler

See also #2759

comment:2 Changed 6 years ago by martinl

I tested patch and took liberty to apply r67315.

comment:3 Changed 6 years ago by martinl

Resolution: fixed
Status: newclosed

Backported in r67360. Closing ticket.

Note: See TracTickets for help on using tickets.