"type with xxxx does not exist" when doing ExecMemoize()

Поиск
Список
Период
Сортировка
От Tender Wang
Тема "type with xxxx does not exist" when doing ExecMemoize()
Дата
Msg-id CAHewXNnT6N6UJkya0z-jLFzVxcwGfeRQSfhiwA+NyLg-x8iGew@mail.gmail.com
обсуждение исходный текст
Ответы Re: "type with xxxx does not exist" when doing ExecMemoize()  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-hackers

Hi,

I met Memoize node failed When I used sqlancer test postgres.
database0=# explain select t0.c0 from t0 join t5 on t0.c0 = (t5.c0 - t5.c0);
                                      QUERY PLAN
--------------------------------------------------------------------------------------
 Nested Loop  (cost=0.17..21.20 rows=4 width=32)
   ->  Seq Scan on t5  (cost=0.00..1.04 rows=4 width=14)
   ->  Memoize  (cost=0.17..6.18 rows=1 width=32)
         Cache Key: (t5.c0 - t5.c0)
         Cache Mode: logical
         ->  Index Only Scan using t0_c0_key on t0  (cost=0.15..6.17 rows=1 width=32)
               Index Cond: (c0 = (t5.c0 - t5.c0))
(7 rows)

database0=# select t0.c0 from t0 join t5 on t0.c0 = (t5.c0 - t5.c0);
ERROR:  type with OID 2139062143 does not exist

How to repeat:
The attached database0.log (created by sqlancer) included statements to repeat this issue.
Firstly, create database test;
then;
psql postgres
\i   /xxx/database0.log

I analyzed aboved issue this weekend. And I found that 
After called ResetExprContext() in MemoizeHash_hash(), the data in mstate->probeslot was corrputed.

in prepare_probe_slot: the data as below:
(gdb) p *(DatumGetRangeTypeP(pslot->tts_values[0]))
$1 = {vl_len_ = 36, rangetypid = 3904}
after called ResetExprContext() in MemoizeHash_hash:
(gdb) p *(DatumGetRangeTypeP(pslot->tts_values[0]))
$3 = {vl_len_ = 264, rangetypid = 2139062143}

I think in prepare_probe_slot(), should called datumCopy as the attached patch does.

Any thoughts? Thanks.
--
Tender Wang
OpenPie:  https://en.openpie.com/
Вложения

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: RangeTblEntry jumble omissions
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Optimize planner memory consumption for huge arrays