BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
Дата
Msg-id 18314-5f44050ce33a5492@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build  (Tender Wang <tndrwang@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18314
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 16.1
Operating system:   Ubuntu 22.04
Description:

When planner chooses to perform parallel index build, it doesn't
check whether functions used in an index expression or predicate are
parallel-safe. For example:
CREATE FUNCTION f() RETURNS int IMMUTABLE PARALLEL UNSAFE
AS $$
BEGIN    
    RETURN 0;
EXCEPTION WHEN OTHERS THEN
    RETURN 1;
END$$ LANGUAGE plpgsql;

CREATE TABLE t(i int);
INSERT INTO t SELECT g FROM generate_series(1, 300000) g;
CREATE INDEX ON t((i + f()));

results in:
ERROR:  cannot start subtransactions during a parallel operation
CONTEXT:  PL/pgSQL function f() line 2 during statement block entry
parallel worker

Although with 200000 records, the index created with no error.

Reproduced on REL_12_STABLE .. master.


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

Предыдущее
От: Tender Wang
Дата:
Сообщение: Re: BUG #18310: Some SQL commands fail to process duplicate objects with error: tuple already updated by self
Следующее
От: David Rowley
Дата:
Сообщение: Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key