Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause
Дата
Msg-id CAMbWs4_i5+xB1WQ5SVOe8SQscaMswx8hbbgA1YKmtAD-vgcxnA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause  ("Lepikhov Andrei" <a.lepikhov@postgrespro.ru>)
Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs

On Tue, Sep 5, 2023 at 10:04 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Richard Guo <guofenglinux@gmail.com> writes:
> BTW, do you think get_name_for_var_field() has similar problem for
> RTE_SUBQUERY case?  The RTE_CTE code path in that function crawls up the
> namespace stack before recursing into the CTE while the RTE_SUBQUERY
> code patch does not, which looks like an oversight.

Hmm, seems suspicious ...

> I tried to find a
> test case to show it's indeed a problem but with no luck.

Note that any test case here would be of the form "dump a view
or rule definition", not "EXPLAIN".  What did you try?

Ah, thanks.  I got one of the form "dump a view" leveraging your test
case from the v2 patch (with a minor tweak).

create view composite_v as
with cte(c) as materialized (select row(1, 2)),
     cte2(c) as (select * from cte)
select 1 from cte2 as t
where (select * from (select c as c1) s
       where (select (c1).f1 > 0)) is not null;

select pg_get_viewdef('composite_v', true);
ERROR:  bogus varno: 1

So it is indeed a problem!

Here is v3 patch which is v2 + fix for this issue.

Thanks
Richard
Вложения

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: BUG #18083: not compile PostgreSQL module in Qt with GCC 11.2 compiler
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #17928: Standby fails to decode WAL on termination of primary