Assertion on create index concurrently

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: pgsql-bugs@lists.postgresql.org
Date: 2021-06-26T18:48:45Z
Lists: pgsql-bugs

Attachments

I found one annoying assertion in the CREATE INDEX CONCURRENTLY 
operation. It will happen if you add into WHERE part of CREATE INDEX 
CONCURRENTLY some function that will make transactional update (see an 
example in the attached patch).

It looks like a hack, but it lead to assertion and restart of the 
instance, that isn't good.
I suggest to perform error, not assertion in this case (see the patch).

This problem affects PG 9.6 - 13. The master branch was fixed 9 months 
ago by commit 83158f7, that made this operation transactional, but still.

-- 
regards,
Andrey Lepikhov
Postgres Professional

Commits

  1. Add test for CREATE INDEX CONCURRENTLY with not-so-immutable predicate

  2. Make index_set_state_flags() transactional