Re: [bug fix] connection service file doesn't take effect with ECPG apps - Mailing list pgsql-hackers

From MauMau
Subject Re: [bug fix] connection service file doesn't take effect with ECPG apps
Date
Msg-id FBCA4ED9D6D6415DAAC7B31F19C0BCA9@maumau
Whole thread Raw
In response to Re: [bug fix] connection service file doesn't take effect with ECPG apps  (Michael Meskes <meskes@postgresql.org>)
Responses Re: [bug fix] connection service file doesn't take effect with ECPG apps
List pgsql-hackers
From: "Michael Meskes" <meskes@postgresql.org>
> Or in other words, I used the connect command you had in your email with a
> services file pointing to a local database and it connected to that 
> database.
> Instead of adding an additional output I checked the log output which 
> suggested
> that host was NULL.

Your test case seems different from my original mail.  In my test case, I 
want to connect to a database on another machine, not on the local one.  For 
example:

1. The ECPG app runs on a machine called client-host.
2. The database server to connect to runs on a machine called server-host.
3. There's no database server running on client-host.
4. The ECPG app uses the connection service file whose contents is:
[my_service]
host=server-host
... other necessary parameters like port, dbname, etc.

The app mistakenly tries to connect to the database server on the local 
machine (client-host), instead of the desired server-host, and fails to 
connect because the database server is not running on client-host.  This is 
because ECPGconnect() passes an empty string (""), not NULL, to 
PQconnectdbParams().

Regards
MauMau







pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: PoC: Partial sort
Next
From: David Rowley
Date:
Subject: Re: [PATCH] Regression tests in windows ignore white space