Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server
Дата
Msg-id CAB7nPqRhsKK8BP1yo=s4ZKH42gzSwTfDWHVT2C_PbK6cqzTkJg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server  (Thomas Munro <thomas.munro@enterprisedb.com>)
Ответы Re: BUG #14220: pg_get_expr() with an incorrect relation id crashes the server  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Fri, Jul 1, 2016 at 5:42 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Maybe the attnum bounds check should be an error rather than an
> assertion, like in the attached.  Thought perhaps with a better
> message...

Quite interesting report. It looks right to me to do so with an elog(ERROR).

+        if (attnum > colinfo->num_cols)
+            elog(ERROR, "cannot decompile bogus attnum: %d", attnum);
Why not "incorrect number of arguments: specified %d but found %d" instead?

I have poked at this bug report yesterday and today, and found that it
is as well possible to hit the second assertion two lines below with a
dropped column. So I would like to propose the patch attached to
replace both assertions with an elog(ERROR). Test cases are included,
though I am not sure if they bring much value.
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Postgres 9.5 Installation on OS X
Следующее
От: lishengxian123@163.com
Дата:
Сообщение: BUG #14221: using postgresql 9.1.22 to 9.3.13 failed using pg_upgrade