psqlodbc copy_and_convert_field "Unrecognized return value"

From: Daniel Kempenich <dan(dot)kempenich(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: psqlodbc copy_and_convert_field "Unrecognized return value"
Date: 2022-03-17 18:14:05
Message-ID: CAFSohAUzatQJ-exEXnEVN3St_d+sxyqxZUXRSXjC=-H1A8XZuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;
}

Browse pgsql-odbc by date

  From Date Subject
Next Message Matthew Reeves 2022-03-20 20:26:45 PostgreSQL via PolyBase (MS-SQL) - Numeric Data Type Issue
Previous Message Maurice Duvigneau 2022-02-25 09:11:55 Very high memory utilization in Wondows 10 and Ubuntu with OBDBC Driver 13.1 and 13.2