pg.ddx.io  GitHub: postgresql-interfaces/psqlodbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: laofeijio2020ojbk2022 (@laofeijio2020ojbk2022) <noreply+laofeijio2020ojbk2022@github.com>
To: postgresql-interfaces/psqlodbc <noreply+postgresql-interfaces-psqlodbc@github.com>
Subject: [postgresql-interfaces/psqlodbc] PR #237: Fix SQLSTATE fallback for STMT_STRING_CONVERSION_ERROR
Date: Thu, 05 Nov 2026 07:48:41 +0000
Message-ID: <gh-postgresql-interfaces-psqlodbc-237@github.com> (raw)

Statement_sqlstate[] was missing an entry for STMT_STRING_CONVERSION_ERROR, so when a string conversion error occurred the SQLSTATE lookup fell back to the generic HY000 (STMT_EXEC_ERROR) instead of the specific 22018 (invalid character value for cast specification).

Add the missing array element so SQLFetch/SQLGetData string conversion errors report 22018 per ODBC Appendix A.

inline patch 1: statement.c (+2/-1 lines) download inline-1.patchdiff --git a/statement.c b/statement.c index 76c9ba7b..e2c4b14d 100644 --- a/statement.c +++ b/statement.c @@ -1317,7 +1317,8 @@ static const struct { STMT_COUNT_FIELD_INCORRECT, "07002", "07002" }, { STMT_INVALID_NULL_ARG, "HY009", "S1009" }, { STMT_NO_RESPONSE, "08S01", "08S01" }, - { STMT_COMMUNICATION_ERROR, "08S01", "08S01" } + { STMT_COMMUNICATION_ERROR, "08S01", "08S01" }, + { STMT_STRING_CONVERSION_ERROR, "22018", "22018" } /* invalid character value for cast specification */ }; static PG_ErrorInfo *

view thread (6+ messages)  latest in thread

Message-ID: <gh-postgresql-interfaces-psqlodbc-237@github.com>
Permalink:  ../gh-postgresql-interfaces-psqlodbc-237@github.com/

 ·  · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox