Skip to content

Commit

Permalink
Add missing error class and quote identifiers
Browse files Browse the repository at this point in the history
Fixes #22035 - case sensitive schema
  • Loading branch information
elpaso committed May 22, 2019
1 parent 5cd8cb6 commit ad24b87
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/plugins/processing/tools/postgis.py
Expand Up @@ -38,6 +38,16 @@
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)


class DbError(Exception):

def __init__(self, message, query=None):
self.message = str(message)
self.query = (str(query) if query is not None else None)

def __str__(self):
return 'MESSAGE: %s\nQUERY: %s' % (self.message, self.query)


def uri_from_name(conn_name):
settings = QgsSettings()
settings.beginGroup(u"/PostgreSQL/connections/%s" % conn_name)
Expand Down Expand Up @@ -862,7 +872,7 @@ def _table_name(self, schema, table):
if not schema:
return self._quote(table)
else:
return u'%s.%s' % (self._quote(schema), self._quote(table))
return u'"%s"."%s"' % (self._quote(schema), self._quote(table))


# For debugging / testing
Expand Down

0 comments on commit ad24b87

Please sign in to comment.