[gdal-dev] Issues specifying PostGIS connection details - possibly related to special characters in passwords?

Robin Wilson robin at rtwilson.com
Tue Jul 2 08:18:10 PDT 2024


Hi,

I’m using ogr2ogr to load a GeoPackage file into a PostGIS database. I initially tried using a command like this:

ogr2ogr --debug ON -f PostgreSQL PG:"host=<IP> user=<user> password=robin$42 dbname=data sslmode=require" file.gpkg -nln table_name

However, this doesn’t work, and I always get an error:

FATAL:  password authentication failed for user “<user>"

If I restructure the command to use the alternative postgresql:// connection string like this, then it works:

ogr2ogr --debug ON -f PostgreSQL 'postgresql://<user>:robin$42@<IP>/data?sslmode=require’ file.gpkg -nln table_name

I don’t remember running into this problem before when connecting to PostGIS databases using the PG: connection string, so I’m wondering whether my shell is doing something strange with my password? Obviously I don’t want to share my actual password, but it has a $ in it, and I wonder whether somehow this is causing problems - but only when using the PG: connection string.

Any suggestions welcome,

Best regards,

Robin


Dr Robin Wilson
www.rtwilson.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240702/d6494243/attachment.htm>


More information about the gdal-dev mailing list