Skip to content

Commit

Permalink
[processing][gdal] Fix empty fid is passed if FID option is not set
Browse files Browse the repository at this point in the history
Also add full range of unit tests for OgrToPostGis algorithm.

Fixes #19947
  • Loading branch information
nyalldawson committed Sep 25, 2018
1 parent 80723e8 commit 6e03253
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/OgrToPostGis.py
Expand Up @@ -288,9 +288,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(self.GEOMTYPE[self.parameterAsEnum(parameters, self.GTYPE, context)])
if len(geocolumn) > 0:
arguments.append(geocolumnstring)
if len(pk) > 0:
if pk:
arguments.append(pkstring)
elif primary_key is not None:
elif primary_key:
arguments.append("-lco FID=" + primary_key)
if len(table) == 0:
table = layername.lower()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/ogr2ogrtopostgislist.py
Expand Up @@ -277,9 +277,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(self.GEOMTYPE[self.parameterAsEnum(parameters, self.GTYPE, context)])
if len(geocolumn) > 0:
arguments.append(geocolumnstring)
if len(pk) > 0:
if pk:
arguments.append(pkstring)
elif primary_key is not None:
elif primary_key:
arguments.append("-lco FID=" + primary_key)
if len(table) == 0:
table = layername.lower()
Expand Down

0 comments on commit 6e03253

Please sign in to comment.