Re: [HACKERS] Index created in BEFORE trigger not updated during INSERT

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] Index created in BEFORE trigger not updated during INSERT
Дата
Msg-id CA+TgmoanG1srpzV0XxyV-OE1zHGdV2ti4eJ7OzFFDZUuT5QaKA@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] Index created in BEFORE trigger not updated during INSERT  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Ответы Re: [HACKERS] Index created in BEFORE trigger not updated duringINSERT  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Mon, May 22, 2017 at 7:05 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
> Not that it is a useful use case, but I believe that this is
> a bug that causes index corruption:
>
> CREATE TABLE mytable(
>    id integer PRIMARY KEY,
>    id2 integer NOT NULL
> );
>
> CREATE FUNCTION makeindex() RETURNS trigger
>    LANGUAGE plpgsql AS
> $$BEGIN
>    CREATE INDEX ON mytable(id2);
>    RETURN NEW;
> END;$$;

I'm willing to bet that nobody ever thought about that case very hard.
It seems like we should either make it work or prohibit it, but I
can't actually see quite how to do either off-hand.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Proposal : For Auto-Prewarm.
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] wal_level > WAL_LEVEL_LOGICAL