Skip to content

Commit

Permalink
Merge pull request #10082 from alexbruy/postgis-comment
Browse files Browse the repository at this point in the history
[db_manager] apply comment to the correct column when altering table column (fix #21425)
  • Loading branch information
alexbruy authored 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
Original file line number Diff line number Diff line change
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.