Description of problem: psqlODBC as shipped in Fedora 9 cannot reliably connect to PostgreSQL via an IPv6 socket. These are the relevant odbcinst.ini and odbc.ini sections: ------------------------ [psqlODBC] Description = Official PostgreSQL ODBC driver Driver = /usr/lib64/psqlodbc.so Driver64 = /usr/lib64/psqlodbc.so Setup = /usr/lib/libodbcpsqlS.so Setup64 = /usr/lib64/libodbcpsqlS.so UsageCount = CPTimeout = CPReuse = FileUsage = 1 ------------------------ [Jelen2] Description = Jelen2 Driver = psqlODBC Trace = No TraceFile = Database = jelen2 Servername = ::1 Username = Password = Port = 5432 Protocol = 7.4 ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = ------------------------ "isql Jelen2 username password" either cannot connect to the server or the first SELECT makes the connection drop. The PostgreSQL log says: LOG: unexpected EOF on client connection Version-Release number of selected component (if applicable): $ rpm -q postgresql-odbc postgresql-odbc-08.03.0100-1.fc9.x86_64 How reproducible: Always Steps to Reproduce: 1. Setup an ODBC DSN using IPv6 server address. 2. Try to connect via isql or some other ODBC app. 3. Actual results: 1 out of approx 4 connections succeeds. But the first stmt makes the app disconnect with some protocol error, in each case "unexpected EOF on client connection" appears in the PostgreSQL log. Expected results: As psqlODBC uses libpq, it should be able to connect just fine. Additional info: Recompiling psqlodbc-08.03.0100 manually doesn't make the problem go away. However, 08.03.0200 or the CVS version (currently 08.03.0201) fixes it.
Hmm ... updating to .0200 would be an easy answer, but how sure are you that that really fixes it? I took a quick look at the diffs from .0100 to .0200 and didn't see anything that looked like it would explain this.
Problem is I cannot be sure. However, from empirical data (about 20 connection), only 3 or 4 was successful to the point where "isql" gave me a prompt instead of a connection error. And soon as I issued a SELECT, I got an error. Now "isql -vvvv" (using 08.03.0100) says: [28000][unixODBC]Communication error during authentication; Error while reading from the socket. [ISQL]ERROR: Could not SQLConnect I just retried it, 20 times out of 20 tries it gave me this error. With 08.03.0200, 20 times out of 20 tries it was successful. But your comment made me read the diff between 0100 and 0200. I found this in docs/release.html: ========================= psqlODBC 08.03.0200 Release Changes: 1.) Fix a bug in socket which uses a socket variable. ... ========================= Isn't it pointing to a socket using bug (however vaguely)? Another datapoint: there's the infamous gcc 4.3.0 bug which made the update to Wine 1.0 in F9 delayed substantially, the bugfix was to use CFLAGS="-fno-tree-fre -fno-tree-pre". Just to be sure that it's not a compiler bug, I recompiled 08.03.0100 with these extra CFLAGS settings and the problem didn't go away.
Yeah, I saw the changelog entry and went ah-hah ... but I can't find any changes in the source code that look like they could be IPv6-related. So the whole thing seems to need closer investigation.
Created attachment 316838 [details] Socket fix from 08.03.0200 This single fix from 08.03.0200 made .0100 work reliably over IPv6.
Bizarre ... it's certainly broken, but it should be just as broken for IPv4. Anyway, I'll bump to .0200 as the best way of resolving this.
postgresql-odbc-08.03.0200-1.fc9 has been submitted as an update for Fedora 9. http://admin.fedoraproject.org/updates/postgresql-odbc-08.03.0200-1.fc9
postgresql-odbc-08.03.0200-1.fc9 has been pushed to the Fedora 9 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update postgresql-odbc'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-8239
postgresql-odbc-08.03.0200-1.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.