[GRASS-SVN] r72591 - grass/trunk/scripts/v.db.dropcolumn

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 5 07:59:27 PDT 2018


Author: mmetz
Date: 2018-04-05 07:59:27 -0700 (Thu, 05 Apr 2018)
New Revision: 72591

Modified:
   grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
Log:
v.db.dropcolumn: preserve field length for field type CHARACTER

Modified: grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2018-04-05 10:16:14 UTC (rev 72590)
+++ grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2018-04-05 14:59:27 UTC (rev 72591)
@@ -89,7 +89,12 @@
                 if f[0] == column:
                     continue
                 colnames.append(f[0])
-                coltypes.append("%s %s" % (f[0], f[1]))
+		# see db_sqltype_name() for type names
+		if f[1] == "CHARACTER":
+		    # preserve field length for sql type "CHARACTER"
+		    coltypes.append("%s %s(%s)" % (f[0], f[1], f[2]))
+		else:
+		    coltypes.append("%s %s" % (f[0], f[1]))
 
             colnames = ", ".join(colnames)
             coltypes = ", ".join(coltypes)



More information about the grass-commit mailing list