Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10082 from alexbruy/postgis-comment
[db_manager] apply comment to the correct column when altering table column (fix #21425)
  • Loading branch information
alexbruy committed May 24, 2019
2 parents 0b7e399 + 03abf0e commit dc6780a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -922,7 +922,8 @@ def updateTableColumn(self, table, column, new_name=None, data_type=None, not_nu
# comment the column
if comment is not None:
schema, tablename = self.getSchemaTableName(table)
sql = u"COMMENT ON COLUMN %s.%s.%s is '%s'" % (schema, tablename, column, comment)
column_name = new_name if new_name is not None and new_name != column else column
sql = u"COMMENT ON COLUMN %s.%s.%s IS '%s'" % (schema, tablename, column_name, comment)
self._execute(c, sql)

self._commit()
Expand Down

0 comments on commit dc6780a

Please sign in to comment.