Hi Robin,

Is this a shell issue, rather than a GDAL one? The dollar sign makes me
suspect that a Unix shell is interpreting "robin$42" as "the string 'robin'
and the value of variable $42" before it gets into GDAL. My terminal would
interpret it as the following:
$ echo robin$42
robin

and I'd need to escape the dollar symbol to get the text verbatim:
$ echo robin\$42
robin$42

Cheers,
Daniel

On Tue, 2 Jul 2024 at 16:35, Robin Wilson via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to