Skip to content
Browse files
[DB Manager] Allow lowercase field names for homogenize PostGIS Import
PostGIS provider has an option to lowercase field names. This options is available for user in QGIS algorithm ImportIntoPostGIS and not in DB Mananger.

This commit fix it.
  • Loading branch information
rldhont committed Oct 19, 2016
1 parent 70186ee commit 7cec85923f0c35440ffcf8df115690f5a386e912
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
@@ -542,6 +542,9 @@ def explicitSpatialIndex(self):
def spatialIndexClause(self, src_table, src_column, dest_table, dest_table_column):
return None

def hasLowercaseFieldNamesOption(self):
return False

class Schema(DbItemObject):

@@ -152,6 +152,8 @@ def runVacuumAnalyzeActionSlot(self, item, action, parent):


def hasLowercaseFieldNamesOption(self):
return True

class PGSchema(Schema):

@@ -104,6 +104,10 @@ def checkSupports(self):
if not self.chkSpatialIndex.isEnabled():

if not self.chkLowercaseFieldNames.isEnabled():

def populateLayers(self):
for index, layer in enumerate(iface.legendInterface().layers()):
@@ -298,13 +302,18 @@ def accept(self):
geom = None

options = {}
if self.chkLowercaseFieldNames.isEnabled() and self.chkLowercaseFieldNames.isChecked():
pk = pk.lower()
if geom:
geom = geom.lower()
options['lowercaseFieldNames'] = True

# get output params, update output URI
self.outUri.setDataSource(schema, table, geom, "", pk)
uri = self.outUri.uri(False)

providerName = self.db.dbplugin().providerName()

options = {}
if self.chkDropTable.isChecked():
options['overwrite'] = True

@@ -253,7 +253,7 @@
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="chkSpatialIndex">
<property name="text">
<string>Create spatial index</string>
@@ -267,6 +267,13 @@
<item row="7" column="0">
<widget class="QCheckBox" name="chkLowercaseFieldNames">
<property name="text">
<string>Convert field names to lowercase</string>

0 comments on commit 7cec859

Please sign in to comment.