Re: Checking return value of SPI_execute

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Checking return value of SPI_execute
Дата
Msg-id 20191106042757.GE1604@paquier.xyz
обсуждение исходный текст
Ответ на Checking return value of SPI_execute  (Mark Dilger <hornschnorter@gmail.com>)
Ответы Re: Checking return value of SPI_execute  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Checking return value of SPI_execute  (Mark Dilger <hornschnorter@gmail.com>)
Список pgsql-hackers
On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote:
> please find attached a patch fixing a problem previously discussed [1] about
> the code inappropriately ignoring the return value from SPI_execute.
>
> I will be adding this to https://commitfest.postgresql.org/26/
> shortly.

Yes, this should be fixed.

> -    SPI_execute(query, true, 0);
> +    spi_result = SPI_execute(query, true, 0);
> +    if (spi_result < 0)
> +        elog(ERROR, "SPI_execute returned %s", SPI_result_code_string(spi_result));

Any queries processed in xml.c are plain SELECT queries, so it seems
to me that you need to check after SPI_OK_SELECT as only valid
result.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH][DOC] Fix for PREPARE TRANSACTION doc and postgres_fdwmessage.
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Include RELKIND_TOASTVALUE in get_relkind_objtype