Merge pull request #39000 from elpaso/bugfix-gh38998-db-manager-pg-rename-schema

Fix PG db-manager rename schema
This commit is contained in:
Alessandro Pasotti 2020-09-24 18:07:47 +02:00 committed by GitHub
commit 5691357181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -901,6 +901,13 @@ class PostGisDBConnector(DBConnector):
self.quoteString(new_table), self.quoteString(tablename), schema_where)
self._executeSql(sql)
def renameSchema(self, schema, new_schema):
try:
self.core_connection.renameSchema(schema, new_schema)
return True
except QgsProviderConnectionException:
return False
def commentTable(self, schema, tablename, comment=None):
if comment is None:
self._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(schema, tablename))