<p></p>
<h2 dir="auto">What version of osm2pgsql are you using?</h2>
<pre><code>2022-02-19 09:36:19 osm2pgsql version 1.6.0 (1.6.0)
Build: RelWithDebInfo
Compiled using the following library versions:
Libosmium 2.17.3
Proj [API 4] Rel. 7.2.1, January 1st, 2021
Lua 5.2.4
</code></pre>
<h2 dir="auto">What operating system and PostgreSQL/PostGIS version are you using?</h2>
<p dir="auto">Uses PostGIS Docker image as base, defined by <a href="https://github.com/rustprooflabs/pgosm-flex/blob/main/Dockerfile">Dockerfile</a>, available via <a href="https://hub.docker.com/r/rustprooflabs/pgosm-flex" rel="nofollow">DockerHub</a>.</p>
<pre><code>┌─────────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────┐
│ version │ postgis_version │
╞═════════════════════════════════════════════════════════════════════════════════════╪═══════════════════════════════════════╡
│ PostgreSQL 14.0 (Debian 14.0-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (…│ 3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 │
│…Debian 10.2.1-6) 10.2.1 20210110, 64-bit │ │
└─────────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────┘
</code></pre>
<h2 dir="auto">Tell us something about your system</h2>
<p dir="auto">Docker container running on local machine with 12 CPU, 64 GB RAM and SSD drives.</p>
<h2 dir="auto">What did you do exactly?</h2>
<p dir="auto">Attempting to update my project to include use of osm2pgsql-replication. The project already uses connection strings in the format <code>postgresql://postgres@localhost/pgosm</code>. I have gone through a couple rounds of local testing osm2pgsql-replication (not in Docker) with success, my rough documentation of what I have done already is <a href="https://github.com/rustprooflabs/pgosm-flex/blob/main/docs/APPEND-MODE.md">here</a>. The problem reported here was encountered as I am working on adding my prior successful testing into the Docker-based process.</p>
<p dir="auto">Using osm2pgsql-replication init with a single connection string results in a psycopg2 error attempting to connect. In this case the command is ran as the <code>root</code> user so it reports the <code>root</code> user does not exist. This is a clear indication the conninfo string is not parsed, otherwise the <code>postgres</code> role would be used for the connection.</p>
<pre><code>root@965797fa7760:/app# osm2pgsql-replication init -d postgresql://postgres@localhost/pgosm --osm-file /app/output/district-of-columbia-latest.osm.pbf
Traceback (most recent call last):
File "/usr/local/bin/osm2pgsql-replication", line 531, in <module>
sys.exit(main())
File "/usr/local/bin/osm2pgsql-replication", line 523, in main
conn = connect(args)
File "/usr/local/bin/osm2pgsql-replication", line 78, in connect
return psycopg.connect(dbname=args.database, user=args.username,
File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist
</code></pre>
<h2 dir="auto">What did you expect to happen?</h2>
<p dir="auto">I expect the above to work and return the same successful output received when I split the conn string apart.</p>
<pre><code>root@965797fa7760:/app# osm2pgsql-replication init -d pgosm -U postgres -H localhost --osm-file /app/output/district-of-columbia-latest.osm.pbf
2022-02-19 09:53:37 [INFO]: Initialised updates for service 'http://download.geofabrik.de/north-america/us/district-of-columbia-updates'.
2022-02-19 09:53:37 [INFO]: Starting at sequence 3251 (2022-02-18 21:21:54+00:00).
</code></pre>
<p dir="auto">I checked <code>osm2pgsql-replication --init help</code> output which states the conninfo string format should be supported.</p>
<pre><code> -d DB, --database DB Name of PostgreSQL database to connect to or conninfo string
</code></pre>
<p dir="auto">Based on the help output this appears it should work. This format already works with osm2pgsql itself so would be handy to support here too.</p>
<h2 dir="auto">What did you do to try analyzing the problem?</h2>
<p dir="auto">I verified my conn string was valid, tried a number of variations of the conn string format to make sure it wasn't just an edge case misunderstanding, and I triple checked the help output that clearly states that a conninfo string should be supported. I verified my connection string format against <a href="https://pgpedia.info/c/conninfo.html" rel="nofollow">other resources</a> to be sure (again) that my format wasn't invalid or unusual.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/issues/1643">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353SLAKCZQPJXSN6G26TU37FIDANCNFSM5O2YONCA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AA6353U6NG5S7H6NAF3USK3U37FIDA5CNFSM5O2YONCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4RB4FOFQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/osm2pgsql/issues/1643</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/issues/1643",
"url": "https://github.com/openstreetmap/osm2pgsql/issues/1643",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>