postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vadz (@vadz) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #89: Batch update with some invalid values fails for all rows
Date: Tue, 28 Jan 2025 17:03:53 +0000
Message-ID: <[email protected]> (raw)
Suppose there is the following table in the database:
```sql
create table t(x integer check (x<100));
```
and consider a program which does something like the following (simplified):
```cpp
constexpr int ARRAY_SIZE = 2;
SQLSetStmtAttr(h, SQL_ATTR_PARAMSET_SIZE, (void *)ARRAY_SIZE, 0);
SQLINTEGER values[ARRAY_SIZE] = { 1, 101 }; // First value is valid, second one is not.
SQLLEN inds[ARRAY_SIZE];
SQLBindParameter(h, 1, SQL_PARAM_INPUT, SQL_C_INTEGER, SQL_INTEGER, 0, 0, values, 0, inds);
SQLUSMALLINT status[ARRAY_SIZE];
SQLSetStmtAttr(h, SQL_ATTR_PARAM_STATUS_PTR, status, 0);
SQLPrepare(h, "insert into t(x) values(?)", SQL_NTS);
SQLRETURN rc = SQLExecute(h);
```
When using SQL Server with either Microsoft ODBC driver or FreeTDS, `rc` is `SQL_SUCCESS_WITH_INFO` and `status` array is filled with `{ SQL_PARAM_SUCCESS, SQL_PARAM_ERROR }` which is nice because it allows the application to determine which row(s) contained values that resulted in an error.
When using PostgreSQL ODBC driver (v13.02, but from examining Git history it doesn't look like there have been any changes here even in the latest version), `rc` is `SQL_ERROR` and `status` contains `SQL_PARAM_ERROR` for both elements, which doesn't provide any useful information.
Is this behaviour intentional and, if not, would it be possible to change it to be more consistent with other ODBC drivers and, also, more useful?
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://postgresql-interfaces/psqlodbc
Cc: [email protected], [email protected]
Subject: Re: [postgresql-interfaces/psqlodbc] issue #89: Batch update with some invalid values fails for all rows
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox