Hello
This works as documented:
https://www.postgresql.org/docs/current/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY
> PostgreSQL must perform two scans of the table, and in addition it must wait for all existing transactions that could
potentiallymodify or use the index to terminate
> Before each table scan, the index build must wait for existing transactions that have modified the table to
terminate.After the second scan, the index build must wait for any transactions that have a snapshot (see Chapter 13)
predatingthe second scan to terminate. Then finally the index can be marked ready for use, and the CREATE INDEX command
terminates
So create index concurrently waiting your transaction.
regards, Sergei