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: 1
  • column=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:

  1. adding a new column with the new name,
  2. transferring the contents of the old column to the new column,
  3. 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.execute
  • v.db.addcolumn
  • v.db.addtable
  • v.db.connect
  • v.db.dropcolumn
  • v.db.droptable
  • v.db.select
  • v.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