Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Jorge Gustavo Rocha <jgr(at)geomaster(dot)pt>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Jürgen E(dot) Fischer <jef(at)norbit(dot)de>
Subject: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Date: 2019-06-18 14:54:40
Message-ID: CA+mi_8aBnLKypX2Ttksg8JEhApBo=JpF6P_STQGp-FOvDpn6Yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jun 18, 2019 at 3:43 PM Jorge Gustavo Rocha <jgr(at)geomaster(dot)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:

https://github.com/psycopg/psycopg2/blob/master/scripts/appveyor.py

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-06-18 18:44:34 BUG #15859: Postgres 11 repository is missing extensions
Previous Message Jorge Gustavo Rocha 2019-06-18 14:43:10 Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2