v.db.renamecolumn(1)
π v.db.renamecolumn β the GRASS GIS User's Manual glow-up
okay bestie, sit down, hydrate, because we're about to rename a column and it's gonna be so clean. this is v.db.renamecolumn(1) from the GRASS GIS manual and she is a whole vibe. π
β¨ NAME β¨
v.db.renamecolumn β renames a column in the attribute table connected to a given vector map. that's it, that's the whole job, and she does it flawlessly. π
π·οΈ KEYWORDS π·οΈ
vector, attribute table, database, rename
so basically: vector stuff, tables, databases, and the act of renaming. iykyk.
π SYNOPSIS π
v.db.renamecolumn
v.db.renamecolumn --help
v.db.renamecolumn map=name [layer=string] column=oldcol,newcol
[--help] [--verbose] [--quiet] [--ui]
π© Flags π©
--helpβ prints the usage summary, like a little cheat sheet when you're lost. π«Ά--verboseβ verbose module output. she tells you everything, main character energy.--quietβ quiet module output. no commentary, just results. π--uiβ forces the GUI dialog to launch, for when you want the pretty buttons. β¨
π Parameters π
map=name[required] β the name of the vector map. or, plot twist, the data source for direct OGR access. πlayer=stringβ layer number or name. here's the tea: vector features can have category values in different layers, and this number decides which layer we're working with. when you're doing direct OGR access, this is the layer name instead. default:1column=oldcol,newcol[required] β the old and new name of the column, formatted as(old,new). literally just old comma new. periodt. π
π DESCRIPTION π
v.db.renamecolumn renames a column in the attribute table connected to a given vector map. and because she's a considerate icon, she automatically checks the connection for the specified layer first. no cap, she does the vibe check for you. πΈ
π§ NOTES π§ (the important lore)
so here's the situation, and it's giving technical:
if the map table is connected through the DBF or SQLite drivers, the renaming is internally done by:
- adding a new column with the new name,
- transferring the contents of the old column to the new column,
- dropping the old column.
this whole little dance is needed because DBF and SQLite do not support the "ALTER TABLE" command to rename columns. π
because of that three-step situation, the renamed column shows up as the last column of the table. it's original position cannot be maintained. she's not being difficult, it's just the driver's fault, ok?? π
and now the plot twist nobody asked for: the SQLite driver will exit with an error if the column rename involves only a change of case β i.e., upper-to-lowercase, or lower-to-uppercase. why? because the SQLite protocol considers "NAME" and "name" to be identical column names. π
in cases like these, the user should rename the original column to an intermediary name, then rename the intermediary to the final name. two steps. iconic workaround. slay. π₯
β EXAMPLES β
Renaming a column:
g.copy vect=roadsmajor,myroads
v.info -c myroads
v.db.renamecolumn myroads column=ROAD_NAME,roadname
v.info -c myroads
look at her go. v.info -c before, rename, v.info -c after. glow-up complete. π¦
π SEE ALSO π
db.executev.db.addcolumnv.db.addtablev.db.connectv.db.dropcolumnv.db.droptablev.db.selectv.db.update
and the whole GRASS SQL interface, because she runs with a crowd. π
π AUTHOR π
Markus Neteler
π SOURCE CODE π
Available at: v.db.renamecolumn source code (history)
Accessed: Saturday Jan 17 05:41:52 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
okay bestie that's the whole page, no notes, go rename some columns responsibly. mwah. π β¨π GRASS 8.4.2 forever π¦πΈ
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms