PostgreSQL 14.0.0, PSQLODBC30A.DLL 13.02.0000

Windows x64 Windows 10

 

Driver returns empty string for ODBC API call SQLColAttribute SQL_DESC_TYPE_NAME for interval data type name.

 

Steps to repeat:

 

1 create test table with interval columns data types:

 

create table test_timestamp2 (

  col1 VARCHAR(20) not null,

  interval_ INTERVAL HOUR TO SECOND,

  interval0 INTERVAL HOUR TO SECOND,

  interval1 INTERVAL HOUR TO second(1),

  interval2 INTERVAL HOUR TO second(2),

  interval3 INTERVAL HOUR TO second(3),

  interval4 INTERVAL HOUR TO second(4),

  interval5 INTERVAL HOUR TO second(5),

  interval6 INTERVAL HOUR TO second(6),

  constraint pk_test_timestamp2 primary key (col1)

);

 

2 Prepare statement

Select

*

From

test_timestamp2

 

3 step through the resultset columns and call SQLColAttribute on each column of the resultset.

 

Char type_name[128];

SQLSMALLINT nLen = 0;

 

SQLColAttribute(

                hstmt,

                nCol,

                SQL_DESC_TYPE_NAME,

                type_name,

                sizeof(type_name),

                &nLen,

                NULL);

 

4 Expected to get the data type names In type_name buffer, example:

INTERVAL HOUR TO SECOND

INTERVAL HOUR TO SECOND

INTERVAL HOUR TO second(1)

INTERVAL HOUR TO second(2)

 

instead driver sets nLen to 0 and type_name buffer is empty.

 

Attached is screen shot and driver log with SQLColAttribute calls.

Excerpt:

 

cmpdata         4984-888  ENTER SQLPrepare

            HSTMT               0x00000000093612D0

            UCHAR *             0x000000000A825EC8 [      50] "select * from "pgrep"."devschem"."test_timestamp2""

            SDWORD                    50

 

cmpdata         4984-888  EXIT  SQLPrepare  with return code 0 (SQL_SUCCESS)

            HSTMT               0x00000000093612D0

            UCHAR *             0x000000000A825EC8 [      50] "select * from "pgrep"."devschem"."test_timestamp2""

            SDWORD                    50

 

cmpdata         4984-888  ENTER SQLNumResultCols

            HSTMT               0x00000000093612D0

            SWORD *             0x000000000014B474

 

cmpdata         4984-888  EXIT  SQLNumResultCols  with return code 0 (SQL_SUCCESS)

            HSTMT               0x00000000093612D0

            SWORD *             0x000000000014B474 (9)

 

cmpdata         4984-888  ENTER SQLGetStmtAttr

            SQLHSTMT            0x00000000093612D0

            SQLINTEGER               10012 <SQL_ATTR_IMP_ROW_DESC>

            SQLPOINTER          0x000000000014B4B8

            SQLINTEGER                   8

            SQLINTEGER *        0x000000000014B4D4

 

cmpdata         4984-888  EXIT  SQLGetStmtAttr  with return code 0 (SQL_SUCCESS)

            SQLHSTMT            0x00000000093612D0

            SQLINTEGER               10012 <SQL_ATTR_IMP_ROW_DESC>

            SQLPOINTER          0x000000000014B4B8 ( 0x0000000009361708)

            SQLINTEGER                   8

            SQLINTEGER *        0x000000000014B4D4 (-858993460)

 

 

…..

 

cmpdata         4984-888  ENTER SQLColAttribute

            SQLHSTMT            0x00000000093612D0

            SQLSMALLINT                  2

            SQLSMALLINT                 14 <SQL_DESC_TYPE_NAME>

            SQLPOINTER         0x00000000101EAAB0

            SQLSMALLINT                257

            SQLSMALLINT *       0x000000000014B604

            SQLPOINTER          0x0000000000000000 (NYI)

 

cmpdata         4984-888  EXIT  SQLColAttribute  with return code 0 (SQL_SUCCESS)

            SQLHSTMT            0x00000000093612D0

            SQLSMALLINT                  2

            SQLSMALLINT                 14 <SQL_DESC_TYPE_NAME>

            SQLPOINTER         0x00000000101EAAB0

            SQLSMALLINT                257

            SQLSMALLINT *       0x000000000014B604 (0)

            SQLPOINTER          0x0000000000000000 (NYI)

 

Farid