Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition
Дата
Msg-id ddc70376-9ddb-8637-eb69-aa7ae6f13378@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: BUG #15437: Segfault during insert into declarative partitioned table with a trigger creating partition  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition  (Dmitry Shalashov <skaurus@gmail.com>)
Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: BUG #15437: Segfault during insert into declarative partitionedtable with a trigger creating partition  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
On 2018/10/19 11:52, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
>> On 2018/10/18 20:57, PG Bug reporting form wrote:
>>> I tried to use declarative partitioning and, to avoid creating partitions by
>>> hand, to make them in ON BEFORE STATEMENT trigger. Trigger executes
>>> successfully (proved that with RAISE NOTICE), but server crashes.
> 
>> The problem here is with the server allowing to create a partition of the
>> table being inserted into, inside the table's BEFORE INSERT trigger.
>> Generally speaking, the command that's run inside the trigger shouldn't
>> have been allowed to proceed if it might change the table's properties
>> that the execution of the ongoing command is depending upon.
> 
> Check.
> 
>> I propose the attached to fix that.
> 
> Hmm ... I wonder if we shouldn't do CheckTableNotInUse for *both* cases,
> is_partition or no?

Yeah, that would be better robustness-wise, but I couldn't think of a case
where not doing CheckTableNotInUse for the !is_partition case would be
problematic.  Adding an inheritance child doesn't change the relcache
content of the parent table, but for partitioning it does.  Maybe I'm
missing something though.

Attached updated patch adds the check for both cases, although I'm not
sure what the error message text added by the patch should look like.  Is
the following OK?

CheckTableNotInUse(relation, "CREATE TABLE INHERITS / PARTITION OF");

Thanks,
Amit

Вложения

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15440: pg_dump does not preserve quoted identifiers forstatement-level trigger transition table names
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15440: pg_dump does not preserve quoted identifiers for statement-level trigger transition table names