Error check always bypassed in tablefunc.c

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Error check always bypassed in tablefunc.c
Дата
Msg-id CAB7nPqQ+pC0FA=akasXe-zNaAV+eYdRiBj68Cq+u1i6e6HRDkA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Error check always bypassed in tablefunc.c  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Hi all,

As mentioned in $subject, commit 08c33c4 of 2003 has made the
following block of code dead in tablefunc.c:1320 because level is
incremented to at least 1:
                /* First time through, do a little more setup */
                if (level == 0)
                {
                        /*
                         * Check that return tupdesc is compatible
with the one we got
                         * from the query, but only at level 0 -- no
need to check more
                         * than once
                         */

                        if (!compatConnectbyTupleDescs(tupdesc, spi_tupdesc))
                                ereport(ERROR,
                                                (errcode(ERRCODE_SYNTAX_ERROR),
                                                 errmsg("invalid return type"),
                                                 errdetail("Return and
SQL tuple descriptions are " \

"incompatible.")));
                }

A simple fix is simply to change "level == 0" to "level == 1" to check
for this error, like in the patch attached. This issue has been
spotted by Coverity.
Regards,
--
Michael

Вложения

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Safe memory allocation functions
Следующее
От: Noah Misch
Дата:
Сообщение: Re: orangutan seizes up during isolation-check