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
Список
Дерево обсуждения
SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error "Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror "Inoue, Hiroshi" <h-inoue@dream.email.ne.jp>
RE: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror "Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror "Inoue, Hiroshi" <h-inoue@dream.email.ne.jp>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error Tom Lane <tgl@sss.pgh.pa.us>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error "Jonah H. Harris" <jonah.harris@gmail.com>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes with error Tom Lane <tgl@sss.pgh.pa.us>
RE: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror "Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>
Re: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror Clemens Ladisch <clemens@ladisch.de>
RE: SQLExecDirectW returns SQL_SUCCESS even if sql finishes witherror "Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>
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 по дате отправления
От: Igor Korot
Дата:
Сообщение: Re: Log file
От: Inoue, Hiroshi
Дата:
FAQ