<div dir="auto">I think the trick there is that single quotes make most shells consider a string verbatim - I'd forgotten that part! That's probably the more desirable solution, actually.<div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Daniel</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 2 Jul 2024, 17:13 Robin Wilson, <<a href="mailto:robin@rtwilson.com">robin@rtwilson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica,Arial;font-size:13px">Hi,</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">Hmm, I’m sure I tried escaping it before - but putting a \ in front of it fixed it - obviously I didn’t try properly before. Possibly I only tried quoting it in various ways. Thanks for the solution!</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">Now the thing I’m intrigued about is why it was working with the postgresql:// connection string but not the PG connection string…</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px"><div style="margin:0px">Best regards,</div><div style="margin:0px"><br></div><div style="margin:0px">Robin</div></div> <div class="gmail_signature"></div> <br><p>On 2 July 2024 at 17:08:18, Daniel Evans (<a href="mailto:daniel.fred.evans@gmail.com" target="_blank" rel="noreferrer">daniel.fred.evans@gmail.com</a>) wrote:</p> <blockquote type="cite"><span><div><div></div><div><div dir="ltr"><div>Hi Robin,</div><div><br></div><div>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:<br></div><div></div><div>$ echo robin$42<br>robin</div><div><br></div><div>and I'd need to escape the dollar symbol to get the text verbatim:</div><div></div><div>$ echo robin\$42<br>robin$42</div><div><br></div><div>Cheers,</div><div>Daniel<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 2 Jul 2024 at 16:35, Robin Wilson via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div style="font-family:Helvetica,Arial;font-size:13px">Hi,</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">I’m using ogr2ogr to load a GeoPackage file into a PostGIS database. I initially tried using a command like this:</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">ogr2ogr --debug ON -f PostgreSQL PG:"host=<IP> user=<user> password=robin$42 dbname=data sslmode=require" file.gpkg -nln table_name</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">However, this doesn’t work, and I always get an error:</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">FATAL:  password authentication failed for user “<user>"</div><div><br></div>If I restructure the command to use the alternative postgresql:// connection string like this, then it works:<div><br></div><div>ogr2ogr --debug ON -f PostgreSQL 'postgresql://<user>:robin$42@<IP>/data?sslmode=require’ file.gpkg -nln table_name<br><div class="gmail_signature"></div></div><div class="gmail_signature"><br></div><div class="gmail_signature">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.</div><div class="gmail_signature"><br></div><div class="gmail_signature">Any suggestions welcome,</div><div class="gmail_signature"><br></div><div class="gmail_signature"><div class="gmail_signature">Best regards,</div><div class="gmail_signature"><br></div><div class="gmail_signature">Robin</div><div class="gmail_signature"><br></div><div class="gmail_signature"><br></div><div class="gmail_signature">Dr Robin Wilson</div><div class="gmail_signature"><a href="http://www.rtwilson.com" target="_blank" rel="noreferrer">www.rtwilson.com</a></div><div class="gmail_signature"><br></div></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></blockquote></div>
</div></div></span></blockquote></div></blockquote></div>