Skip to content

Commit be3e807

Browse files
committed
[processing] Allow using libpq defaults for host,port,user,pass and dbname
Fixes #15706
1 parent 979d619 commit be3e807

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

python/plugins/processing/algs/gdal/ogr2ogrtopostgis.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,20 @@ def getConsoleCommands(self):
202202
arguments.append('"' + shapeEncoding + '"')
203203
arguments.append('-f')
204204
arguments.append('PostgreSQL')
205-
arguments.append('PG:"host=' + host)
206-
arguments.append('port=' + port)
207-
if len(dbname) > 0:
205+
arguments.append('PG:"')
206+
if host:
207+
arguments.append(' host=' + host)
208+
if port:
209+
arguments.append('port=' + port)
210+
if dbname:
208211
arguments.append('dbname=' + dbname)
209-
if len(password) > 0:
212+
if password:
210213
arguments.append('password=' + password)
211-
if len(schema) > 0:
214+
if schema:
212215
arguments.append('active_schema=' + schema)
213-
else:
214-
arguments.append('active_schema=public')
215-
arguments.append('user=' + user + '"')
216+
if user:
217+
arguments.append('user=' + user)
218+
arguments.append('"')
216219
arguments.append(dimstring)
217220
arguments.append(ogrLayer)
218221
arguments.append(ogrLayerName(inLayer))

0 commit comments

Comments
 (0)