Skip to content

Commit ec3da40

Browse files
committed
[processing] Some fixes to handling of uppercase/lowercase geometry column names
1 parent ed076d0 commit ec3da40

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

python/plugins/processing/algs/admintools/ImportIntoPostGIS.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,22 @@ def processAlgorithm(self, progress):
9292
if not geomColumn:
9393
geomColumn = 'the_geom'
9494

95-
uri = QgsDataSourceURI()
96-
uri.setConnection(host, str(port), database, username, password)
97-
if primaryKeyField:
98-
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
99-
else:
100-
uri.setDataSource(schema, table, geomColumn, '')
101-
10295
options = {}
10396
if overwrite:
10497
options['overwrite'] = True
10598
if convertLowerCase:
10699
options['lowercaseFieldNames'] = True
100+
geomColumn = geomColumn.lower()
107101
if dropStringLength:
108102
options['dropStringConstraints'] = True
103+
104+
uri = QgsDataSourceURI()
105+
uri.setConnection(host, str(port), database, username, password)
106+
if primaryKeyField:
107+
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
108+
else:
109+
uri.setDataSource(schema, table, geomColumn, '')
110+
109111
layerUri = self.getParameterValue(self.INPUT)
110112
layer = dataobjects.getObjectFromUri(layerUri)
111113
(ret, errMsg) = QgsVectorLayerImport.importLayer(

0 commit comments

Comments
 (0)