Skip to content

Commit dc6780a

Browse files
authored
Merge pull request #10082 from alexbruy/postgis-comment
[db_manager] apply comment to the correct column when altering table column (fix #21425)
2 parents 0b7e399 + 03abf0e commit dc6780a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/plugins/db_manager/db_plugins/postgis/connector.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ def updateTableColumn(self, table, column, new_name=None, data_type=None, not_nu
922922
# comment the column
923923
if comment is not None:
924924
schema, tablename = self.getSchemaTableName(table)
925-
sql = u"COMMENT ON COLUMN %s.%s.%s is '%s'" % (schema, tablename, column, comment)
925+
column_name = new_name if new_name is not None and new_name != column else column
926+
sql = u"COMMENT ON COLUMN %s.%s.%s IS '%s'" % (schema, tablename, column_name, comment)
926927
self._execute(c, sql)
927928

928929
self._commit()

0 commit comments

Comments
 (0)