[GRASS-user] Trying to rename a column

Maciej Sieczka tutey at o2.pl
Thu Aug 14 04:15:54 EDT 2008


Thomas Adams pisze:

> Ultimately what I am trying to do is to make a varchar(5) field be a 
> varchar(8) field — but I don't see how to do this directly. So, I 
> thought if I created a new varchar(8) column, copied the values of the 
> varchar(5) column into it (This all worked fine); then, renamed the 
> varchar(5) column to 'foo' (which also worked), then I could rename the 
> varchar(8) column to what the column name was for the original 
> varchar(5) column — this does NOT work.

Paste the exact command with an error message, v.info -c of the vector
map for which the command fails, your GRASS version and platform.

> Also, I would like to delete the 
> 'foo' column, but I don't see how to do this.

v.db.dropcol (it's been available since GRASS 6.3). If you don't have
it you can just fetch it from GRASS SVN [1], put somewhere on your
executable path and call it from GRASS, or use such a command:

echo "ALTER TABLE $table DROP COLUMN $col" | db.execute

[1]http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/scripts

Maciek

-- 
Maciej Sieczka
www.sieczka.org


More information about the grass-user mailing list