0

I have a Centos 7 box with unixODBC 2.3.1 and postgresql-odbc 12.02 installed, which is connecting to a PostgreSQL server also running v12.

Although I believe I have configured ODBC to use the v12.0 protocol, it does not seem to be. When connected to the server and attempting to get a list of columns in a table I get the error, column c.relhasoids does not exist. This column was removed from pg_catalog.pg_class in PostgreSQL v12.

postgresql-odbc was specifically updated to not use this column when the protocol is v12 so I can only assume I’m not.

I have Protocol = 12.0 in my /etc/odbcinst.ini and if I run strace isql my-connector I can see it loading the postgresql12 libs from /usr/pgsql-12 as configured.

I’m stumped!

# yum list installed | grep -i -e 'odbc' -e 'postgresql'
postgresql12-libs.x86_64               12.3-5PGDG.rhel7                @pgdg12  
postgresql12-odbc.x86_64               12.02.0000-1PGDG.rhel7          @pgdg-common
unixODBC.x86_64                        2.3.1-14.el7                    @base    
unixODBC-devel.x86_64                  2.3.1-14.el7                    @base  
# cat /etc/odbc.ini
[my-connector]
Description = My PG connection
Driver = PostgreSQL12
Database = mydb
Servername = mydatabase.example.com
UserName = myself
Password = mypassword
Port = 25061
Protocol = 12.0
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
SSLMode = require
UseServerSidePrepare = No
# cat /etc/odbcinst.ini
[PostgreSQL12]
Description=ODBC for PostgreSQL
Setup=/usr/lib/libodbcpsqlS.so
Setup64=/usr/lib64/libodbcpsqlS.so
Driver=/usr/pgsql-12/lib/psqlodbcw.so
Driver64=/usr/pgsql-12/lib/psqlodbcw.so
FileUsage=1
# isql my-connector -v -3
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select id from roles where name = 'admin';
+------------+
| id         |
+------------+
| 2          |
+------------+
SQLRowCount returns 1
1 rows fetched
SQL> help roles
[HY000]Error while executing the query
[42703]ERROR: column c.relhasoids does not exist
[ISQL]ERROR: Could not SQLColumns
davecardwell
  • 105
  • 4

0 Answers0