<p></p>
<p dir="auto">Looks like parsing the DSN needs to be done in a completely different way in psycopg2 and psycopg3. So that will only work with lots of fiddeling, I'm afraid.</p>
<p dir="auto">What works for both is the <code>dsn</code> parameter for connect. So I would rather check if the <code>dbname</code> parameter looks like a connection string (presence of <code>=</code> or <code>://</code>) and then feed it in as a DSN.</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/pull/1645#issuecomment-1053477472">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353THP4IO5GQGNK6YU3TU5H5BRANCNFSM5PLRC7ZQ">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/AA6353TTWGJFFSNEI4UU4LLU5H5BRA5CNFSM5PLRC7Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOH3FMUYA.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/pull/1645/c1053477472</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/pull/1645#issuecomment-1053477472",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1645#issuecomment-1053477472",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>