Skip to content

Commit

Permalink
[Processing] Fix ogr2ogr postgis table overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-morvan committed May 28, 2016
1 parent 94d88e6 commit 75461aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Expand Up @@ -170,9 +170,12 @@ def getConsoleCommands(self):
arguments.append(pkstring)
elif primary_key is not None:
arguments.append("-lco FID=" + primary_key)
if len(table) > 0:
arguments.append('-nln')
arguments.append(table)
if len(table) == 0:
table = ogrLayerName(inLayer).lower()
if schema:
table = '{}.{}'.format(schema, table)
arguments.append('-nln')
arguments.append(table)
if skipfailures:
arguments.append('-skipfailures')
if where:
Expand Down
9 changes: 6 additions & 3 deletions python/plugins/processing/algs/gdal/ogr2ogrtopostgis.py
Expand Up @@ -227,9 +227,12 @@ def getConsoleCommands(self):
arguments.append(pkstring)
elif primary_key is not None:
arguments.append("-lco FID=" + primary_key)
if len(table) > 0:
arguments.append('-nln')
arguments.append(table)
if len(table) == 0:
table = ogrLayerName(inLayer).lower()
if schema:
table = '{}.{}'.format(schema, table)
arguments.append('-nln')
arguments.append(table)
if len(ssrs) > 0:
arguments.append('-s_srs')
arguments.append(ssrs)
Expand Down
9 changes: 6 additions & 3 deletions python/plugins/processing/algs/gdal/ogr2ogrtopostgislist.py
Expand Up @@ -233,9 +233,12 @@ def getConsoleCommands(self):
arguments.append(pkstring)
elif primary_key is not None:
arguments.append("-lco FID=" + primary_key)
if len(table) > 0:
arguments.append('-nln')
arguments.append(table)
if len(table) == 0:
table = ogrLayerName(inLayer).lower()
if schema:
table = '{}.{}'.format(schema, table)
arguments.append('-nln')
arguments.append(table)
if len(ssrs) > 0:
arguments.append('-s_srs')
arguments.append(ssrs)
Expand Down

0 comments on commit 75461aa

Please sign in to comment.