Open MaelREBOUX opened 3 years ago
I can't reproduce on Linux. The active_schema option is supposed to be stripped off from the connection string before being passed to PQconnectdb(). Is your above connection string exactly the one you've used ? I assume you've redacted the password part, but is there possibly strings in the value of some connection parameters ?
Sorry : a pb with copy-paste with a trunked line in the shell. The command line is the right one now.
I can see same behaviour with gdal 2.4.4. and PG12. Connection string returns Error but data are actually in.
~/apps/bin/ogr2ogr --config GDAL_DATA ~/apps/share/gdal/ -f "PostgreSQL" PG:"dbname='shkn' active_schema=_test_shp host='127.0.0.1' port=5432 user='ogr2ogr' password='lopata'" plynovod.shp
ERROR 1: PQconnectdb failed: invalid connection option "active_schema"
ERROR 1: Couldn't establish a database connection
I have also found others face this problem https://stackoverrun.com/fr/q/10620579 https://stackoverflow.com/questions/38535670/can-i-set-search-path-when-importing-a-shape-file-with-ogr2ogr-from-gdal
Also while other connection parameters allow quotation active_schema no. The error appears 3 times.I have omitted some blank lines from output
~/apps/bin/ogr2ogr --config GDAL_DATA ~/apps/share/gdal/ -f "PostgreSQL" PG:"dbname='shkn' active_schema='_test_shp' host='127.0.0.1' port=5432 user='ogr2ogr' password='lopata'" plynovod.shp
ERROR 1: PQconnectdb failed: invalid connection option "active_schema"
ERROR 1: Couldn't establish a database connection
ERROR 1: ERROR: syntax error at or near "_test_shp"
LINE 1: SET search_path=''_test_shp'',public
ERROR 1: ERROR: syntax error at or near "_test_shp"
LINE 1: SET search_path=''_test_shp'',public
ERROR 1: ERROR: syntax error at or near "_test_shp"
LINE 1: SET search_path=''_test_shp'',public
ERROR 1: PostgreSQL driver doesn't currently support database creation.
Please create database with the `createdb' command.
ERROR 1: PostgreSQL driver failed to create PG:dbname='shkn' active_schema='_test_shp' host='127.0.0.1' port=5432 user='ogr2ogr' password=XXXXXXXX
And there is also missing example promised in documentation on page https://gdal.org/drivers/vector/pg.html in section Layer creation options for SCHEMA parametr
Same here ! Any ideas ?
context and actual behavior
ogr2ogr is used in a fmous QGIS plugin : https://github.com/3liz/QgisCadastrePlugin/
As I wanted to load the raw EDIGEO datas to make dev tests, I ran :
Then the ouput is :
So I thinked that any data was write in the database but no : all the expected datas in the tables are here.
Expected behavior
No error message ?
Steps to reproduce the problem.
Get some EDIGEO files here : https://cadastre.data.gouv.fr/data/dgfip-pci-vecteur/2020-01-01/edigeo/departements/
Get QGIS to use the embeded GDAL / ogr2ogr
and run the command line above (point out a THF file)
Operating system
Windows 10 pro
GDAL version and provenance
GDAL 3.0.4, released 2020/01/28 embedded in QGIS 3.10.6