Subject: [postgresql-interfaces/psqlodbc] issue #16: [psqlodbc-REL-16_00_0004][Postgres 15 5][Debian][unixODBC] Need to add CPPFLAGS="-DSQLCOLATTRIBUTE_SQLLEN" to configure to get it to compile

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 09:49:03 +0000

Otherwise we get the error below. Same issue with previous releases.

odbcapi30.c:120:1: error: conflicting types for 'SQLColAttribute'; have 'SQLRETURN(void *, SQLUSMALLINT,  SQLUSMALLINT,  void *, SQLSMALLINT,  SQLSMALLINT *, void *)' {aka 'short int(void *, short unsigned int,  short unsigned int,  void *, short int,  short int *, void *)'}
  120 | SQLColAttribute(SQLHSTMT StatementHandle,
      | ^~~~~~~~~~~~~~~
In file included from psqlodbc.h:145,
                 from odbcapi30.c:21:
/usr/local/include/sql.h:613:24: note: previous declaration of 'SQLColAttribute' with type 'SQLRETURN(void *, SQLUSMALLINT,  SQLUSMALLINT,  void *, SQLSMALLINT,  SQLSMALLINT *, SQLLEN *)' {aka 'short int(void *, short unsigned int,  short unsigned int,  void *, short int,  short int *, long int *)'}
  613 |     SQLRETURN  SQL_API SQLColAttribute(SQLHSTMT StatementHandle,
      |                        ^~~~~~~~~~~~~~~

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 13 May 2024 10:56:28 +0000

@jboakye when did it stop compiling ?

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 11:44:41 +0000

@davecramer  I only downloaded it a few days ago and found the issue with it. This is my first time having to compile it on debian and standalone from the postgres source tree (I think) and in general I have not had to deal with this driver for over 4 years or so as I was too busy to work on this project that requires it.

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 11:46:07 +0000

I tried the 8xx release also in the last few days and found the same issue.

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 11:49:30 +0000

This is the actual compiler invocation if that helps:
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I -I/d/postgres/postgresql_15_5/src/bin/include -I/d/postgres/postgresql_15_5/src/bin/include/postgresql/internal -I/usr/local/pgsql/include -I/usr/local/pgsql/include/internal -DUNICODE_SUPPORT -g -O2 -Wall -MT psqlodbcw_la-odbcapi30.lo -MD -MP -MF .deps/psqlodbcw_la-odbcapi30.Tpo -c odbcapi30.c  -fPIC -DPIC -o .libs/psqlodbcw_la-odbcapi30.o

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 11:55:00 +0000

I did bootstrap and then configure prior:
./configure   --with-unixodbc=/usr/local/bin  --with-libpq=/d/postgres/postgresql_15_5/src/bin

Everything works fine with this configure line (and after replacing _strdup with strdup in psqlodbc.h):
./configure CPPFLAGS="-DSQLCOLATTRIBUTE_SQLLEN"  --with-unixodbc=/usr/local/bin  --with-libpq=/d/postgres/postgresql_15_5/src/bin