psqlodbc copy_and_convert_field "Unrecognized return value" - Mailing list pgsql-odbc

From Daniel Kempenich
Subject psqlodbc copy_and_convert_field "Unrecognized return value"
Date
Msg-id CAFSohAUzatQJ-exEXnEVN3St_d+sxyqxZUXRSXjC=-H1A8XZuA@mail.gmail.com
Whole thread Raw
List pgsql-odbc
In my client code I was seeing the message through the odbc driver: native=<8> sqlerror=<Unrecognized return value from copy_and_convert_field.> sqlstate=<HY000> during a fetch.  There are only a few places where copy_and_convert_field return SQL_ERROR instead of a COPY specific or COPY_GENERAL_ERROR with a message.  I believe it comes from psqlodbc's results.c when the convert returns SQL_ERROR instead of COPY_*

Would it be possible to update the convert.c to something like the following to print a more specific message to aid in debugging?

Thanks,
Dan.

(From the git branch: REL-13_02_0000)

diff --git a/convert.c b/convert.c
index d94fdb6..e525bd1 100644
--- a/convert.c
+++ b/convert.c
@@ -1277,7 +1277,8 @@ copy_and_convert_field(StatementClass *stmt,
        {
                if (stmt->current_col >= opts->allocated)
                {
-                       return SQL_ERROR;
+                       SC_set_error(stmt, STMT_INTERNAL_ERROR, "current column is greater than amount allocated", func);
+                       return  COPY_GENERAL_ERROR;
                }
                if (gdata->allocated != opts->allocated)
                        extend_getdata_info(gdata, opts->allocated, TRUE);
@@ -1389,7 +1390,7 @@ MYLOG(0, "null_cvt_date_string=%d\n", conn->connInfo.cvt_null_date_string);
                else
                {
                        SC_set_error(stmt, STMT_RETURN_NULL_WITHOUT_INDICATOR, "StrLen_or_IndPtr was a null pointer and NULL data was retrieved", func);
-                       return  SQL_ERROR;
+                       return  COPY_GENERAL_ERROR;
                }

pgsql-odbc by date:

Previous
From: Maurice Duvigneau
Date:
Subject: Very high memory utilization in Wondows 10 and Ubuntu with OBDBC Driver 13.1 and 13.2
Next
From: Matthew Reeves
Date:
Subject: PostgreSQL via PolyBase (MS-SQL) - Numeric Data Type Issue