#6708 closed defect (invalid)
PRELUDE_STATEMENTS results in PQconnectdb error
Reported by: | zimmicz | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Utilities | Version: | 2.1.0 |
Severity: | major | Keywords: | ogr2ogr |
Cc: |
Description
- POSTGIS="2.2.1 r14555" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 2.1.0, released 2016/04/25" LIBXML="2.9.3" LIBJSON="0.11.99" RASTER
- GDAL 2.1.0, released 2016/04/25
Running ogr2ogr -f "PostgreSQL" PG:"dbname=postgres PRELUDE_STATEMENTS=begin" 600016.xml results in
ERROR 1: PQconnectdb failed: invalid connection option "PRELUDE_STATEMENTS"
ERROR 1: Couldn't establish a database connection ERROR 1: PQconnectdb failed. invalid connection option "PRELUDE_STATEMENTS"
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=postgres PRELUDE_STATEMENTS=begin
Database exists and the same command without the PRELUDE_STATEMENTS part works just fine.
Attachments (1)
Change History (4)
by , 7 years ago
Attachment: | 600016.zip added |
---|
comment:1 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 7 years ago
That's great news, I'm looking forward to try it out. Anyway, could the docs at http://www.gdal.org/drv_pg.html be updated? I don't think I would ever work this out just by reading it.
PRELUDE_STATEMENTS must not be passed in the connection string, but as an open option specified with -doo (for destination open option) in your use case, like :
ogr2ogr -overwrite "pg:dbname=autotest" poly.shp -doo "PRELUDE_STATEMENTS=BEGIN; SET LOCAL statement_timeout TO '1h';" -doo CLOSING_STATEMENTS=COMMIT