Skip to content

Commit 0fbcdda

Browse files
committed
Avoid active_schema OGR option.
The active_schema option is incompatible with PostGIS databases using a schema other than 'public' for their PostGIS functions and tables. [1] Replace it with a combination of explicit schema declaration before the tablename and the 'nln' option to specify the tablename. [1]: https://trac.osgeo.org/gdal/ticket/6071
1 parent 00926e2 commit 0fbcdda

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

versioning_base.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def checkout(pg_conn_info, pg_table_names, sqlite_filename):
218218
'-f', 'SQLite',
219219
'-dsco', 'SPATIALITE=yes',
220220
sqlite_filename,
221-
'PG:"'+pg_conn_info+' active_schema='+schema+'"', table]
221+
'PG:"'+pg_conn_info+'"', schema+'.'+table,
222+
'-nln', table]
222223
#print ' '.join(cmd)
223224
os.system(' '.join(cmd))
224225

@@ -239,7 +240,8 @@ def checkout(pg_conn_info, pg_table_names, sqlite_filename):
239240
'-f', 'SQLite',
240241
'-update',
241242
sqlite_filename,
242-
'PG:"'+pg_conn_info+' active_schema='+schema+'"', table]
243+
'PG:"'+pg_conn_info+'"', schema+'.'+table,
244+
'-nln', table]
243245
#print ' '.join(cmd)
244246
os.system(' '.join(cmd))
245247

@@ -442,8 +444,9 @@ def update(sqlite_filename, pg_conn_info):
442444
'-f', 'SQLite',
443445
'-update',
444446
sqlite_filename,
445-
'PG:"'+pg_conn_info+' active_schema='+diff_schema+'"',
446-
table+"_diff"]
447+
'PG:"'+pg_conn_info+'"',
448+
diff_schema+'.'+table+"_diff",
449+
'-nln', table+"_diff"]
447450
print ' '.join(cmd)
448451
os.system(' '.join(cmd))
449452

@@ -742,10 +745,11 @@ def commit(sqlite_filename, commit_msg, pg_conn_info):
742745
'-preserve_fid',
743746
'-f',
744747
'PostgreSQL',
745-
'PG:"'+pg_conn_info+' active_schema='+diff_schema+'"',
748+
'PG:"'+pg_conn_info+'"',
746749
'-lco',
747750
'FID='+pkey,
748-
sqlite_filename, table+"_diff"]
751+
sqlite_filename, table+"_diff",
752+
'-nln', diff_schema+'.'+table+"_diff"]
749753
if pgeom:
750754
cmd.insert(5, '-lco')
751755
cmd.insert(6, 'GEOMETRY_NAME='+pgeom)

0 commit comments

Comments
 (0)