SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error
От | Takahashi, Ryohei |
---|---|
Тема | SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error |
Дата | |
Msg-id | EE586BE92A4AFB45B03310C2A0C0565D6D0EFC17@G01JPEXMBKW03 обсуждение исходный текст |
Ответы |
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror
|
Список | pgsql-odbc |
Hi, I have a problem in psqlODBC. SQLExecDirectW() returns SQL_SUCCESS even if sql finishes with error when client_min_messages = fatal. It works correctly when client_min_messages = error. I think the cause is following. connection.c CC_send_query_append() ... while (self->pqconn && (pgres = PQgetResult(self->pqconn)) != NULL) // (1) { int status = PQresultStatus(pgres); // (2) if (discardTheRest) continue; switch (status) { ... case PGRES_BAD_RESPONSE: case PGRES_FATAL_ERROR: handle_pgres_error(self, pgres, "send_query", res, TRUE); // (3) ... When client_min_messages = error and sql finishes with error, PostgreSQL server sends 'E' message to the client. (https://www.postgresql.org/docs/11/static/protocol-message-formats.html) In this case, PQgetResult() returns non-NULL in (1) and PQresultStatus() returns PGRES_FATAL_ERROR in (2). Then, handle_pgres_error() is called in (3) and finally SQLExecDirectW() returns SQL_ERROR. However, when client_min_messages = fatal and sql finishes with error, PostgreSQL server sends only 'Z' message to the client. In this case, PQgetResult() returns NULL in (1) and handle_pgres_error() is never called in (3). Then, SQLExecDirectW() returns SQL_SUCCESS. Is this right? Regards, Ryohei Takahashi
В списке pgsql-odbc по дате отправления: