Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2 - Mailing list pgsql-bugs

From Daniele Varrazzo
Subject Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Date
Msg-id CA+mi_8aBnLKypX2Ttksg8JEhApBo=JpF6P_STQGp-FOvDpn6Yw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2  (Jorge Gustavo Rocha <jgr@geomaster.pt>)
Responses Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
List pgsql-bugs
On Tue, Jun 18, 2019 at 3:43 PM Jorge Gustavo Rocha <jgr@geomaster.pt> wrote:
 
psycopg2.OperationalError: could not translate host name "192.168.1.24
" to address: Unknown host

You can see replies related to the '\r' issue.
1) https://github.com/qgis/QGIS/issues/30027#issuecomment-497433789
2) https://github.com/qgis/QGIS/issues/30027#issuecomment-498690261
3) https://github.com/qgis/QGIS/issues/30027#issuecomment-498700090
4) https://github.com/qgis/QGIS/issues/30027#issuecomment-501799219
I didn't invented the '\r' problem. I've just jumped into it.

I didn't found any other issue with line endings problems in Postgresql. Maybe other '\r' are not harmful. But these in front of host names or host addresses are critical to resolve the ip addresses.

But, for the sake of clarity, the summary is this:

Installing QGIS, in Windows, with libpq, if the pg_services.conf file has '\r\n' line endings, the pg_services fails.

Installing QGIS, in Windows, with libpq, if the pg_services.conf file only has '\n' line endings, the pg_services rocks!
In all likelyhood, if you are using psycopg on windows, you are using a libpq compiled for the client, not the libpq shipped with postgres server for windows.

Compiling the libpq happens in this script:


you can verify if the right compiler and libraries are used, or things are used in a way that '\r' is not handled correctly.

-- Daniele

Attachment

pgsql-bugs by date:

Previous
From: Jorge Gustavo Rocha
Date:
Subject: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Next
From: PG Bug reporting form
Date:
Subject: BUG #15859: Postgres 11 repository is missing extensions