Bug 97998

Summary: postgresql-odbc simply doesn't work
Product: [Retired] Red Hat Linux Reporter: Troels Arvin <troels>
Component: postgresql-odbcAssignee: Andrew Overholt <overholt>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-09-15 16:17:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
Fixes bug #97998. Apply against Rawhide's postgresql-odbc spec-file. none

Description Troels Arvin 2003-06-25 10:53:49 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030619

Description of problem:
The library contained in postgresql-odbc is broken, for some reason. A simple
way to see it is to do an "ldd /usr/lib/psqlodbc.so" which reveals that no ODBC
related libraries are linked to the library:

[troels@kurt-II troels]$ ldd /usr/lib/psqlodbc.so
        libc.so.6 => /lib/i686/libc.so.6 (0x40056000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

A more involved way to demonstrate it is to try to actually use the library,
e.g. from unixODBC's "isql" SQL-shell; see "Steps to Reproduce" .

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Set up a PostgreSQL server which is reachable from psql (so we know that
nothing is wrong with PostgreSQL). Instruct PostgreSQL to listen on both a unix
domain socket and a TCP socket (to be sure that this is not causing the
trouble), through an adjustment in /var/lib/pgsql/data/postgresql.conf and allow
access from in /var/lib/pgsql/data/pg_hba.conf
2. Install ODBC in PostgreSQL:
 2a. install the RPM
 2b. as the "postgres" user, run:
     psql -d template1 -f /usr/share/psqlodbc/odbc.sql
3. Create a database and a user to test with.  In this example, there is a
database called "test" to which the user "troels" has access with an empty password:
 3a: As "postgres", provide access for user "troels":
   createuser --createdb --no-adduser troels
 3b: As the "troels" user, I do:
 3c: As the "troels" user, I verify access and that ODBC functions are available:
   [troels@kurt-II troels]$ psql -h localhost -U troels -d troels
   Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
   troels=> select odbc_timestamp();
    2003-06-25 12:10:54.262345+02
   (1 row)
4. Set up ODBC:
 4a. In /etc/odbcinst.ini:
  Description = ODBC for PostgreSQL
  Driver = /usr/lib/psqlodbc.so

 4b. In /etc/odbc.ini:
  Description = PostgreSQL RDBMS
  Driver = PostgreSQL
  Servername = localhost
  Database = troels

5. Try to access with unixODBC's "isql":
  [troels@kurt-II etc]$ isql PostgreSQL troels
  [ISQL]ERROR: Could not SQLConnect

6. Download and install psqlodbc and see that it works if you compile it on your
own (make sure that unixODBC-devel is already installed):
 6a. Get the tar-ball from
 6b. Build+install it:
   $ tar xzf psqlodbc-07.03.0100.tar.gz
   $ cd psqlodbc-07.03.0100
   $ ./configure --with-unixodbc --with-odbcinst=/etc && make
   $ su
   # make install
 6c. Adjust /etc/odbcinst.ini, so that the following line appears:
  Driver = /usr/local/lib/psqlodbc.so
 6d. Run isql again:
  $ isql PostgreSQL troels
  | Connected!                            |

  This shows that something's wrong with the postgresql-odbc RPM while there is
no problem when downloading+building+installing psqlodbc manually.

Additional info:

Also tested latest PostgreSQL+unixODBC (as of June 25) from Rawhide; problem
also exists there.

About step 6b in "Steps to Reproduce": If I omit "--with-unixodbc
--with-odbcinst=/etc", then my home-made psqlodbc.so library breaks. This
suggests that such statements are missing in the spec-file for the
postgresql-odbc package. Actually, if I recompile Rawhide's postgresql-odbc
package with this line
  %configure --with-unixodbc --with-odbcinst=%{_sysconfdir}
(in stead of just "%configure") then things work.

Comment 1 Troels Arvin 2003-06-25 11:02:38 UTC
Created attachment 92608 [details]
Fixes bug #97998. Apply against Rawhide's postgresql-odbc spec-file.

Comment 2 Andrew Overholt 2003-09-15 16:17:51 UTC
Thank you for the _excellent_ bug report!  After some work, this issue is now
resolved in rawhide.  If you could test that and let me know if it works for you
as it does for me, I'd appreciate it.  I'll close this bug in the meantime.

I've made unofficial RHL 9 RPMs available at
http://people.redhat.com/~overholt/postgresql-odbc-7.3-3/ .

Thanks again.

Comment 3 Troels Arvin 2003-09-15 17:40:07 UTC
Works well; thank you.