Open jaki opened 4 years ago
My previous comment references the code that blocks this. Documentation from upstream postgres also states that it doesn't support this:
Another difference is that a regular CREATE INDEX command can be performed within a transaction block, but CREATE INDEX CONCURRENTLY cannot.
https://www.postgresql.org/docs/14/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
Jira Link: DB-2063 Index backfill inside transaction blocks may have issues. For example,
Running
TestPgRegressTrigger
java test with YSQL index backfill enabled also fails becauseCREATE INDEX
is in a trigger function. That inspired this example:Also, vanilla postgres's
CREATE INDEX CONCURRENTLY
disallowed being inside a transaction block (seeutility.c
). Figure out whether it is possible to use index backfill for indexes inside transaction blocks for Yugabyte tables.In the meantime, an upcoming commit will transparently convert
CREATE INDEX
to be nonconcurrent for these cases. This fixes the two examples above (since they then avoid backfill). That's why this issue will be labelled as an enhancement and not a bug.