[GRASS-dev] [GRASS GIS] #2819: v.db.renamecolumn mysql error
GRASS GIS
trac at osgeo.org
Thu Dec 3 11:47:28 PST 2015
#2819: v.db.renamecolumn mysql error
---------------------------------+-------------------------
Reporter: fpouw | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.3
Component: Database | Version: 7.0.2
Keywords: rename column mysql | 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)
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)
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2819>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list