Skip to content

sql: Cannot add and drop (or drop and add) index in same transaction #42844

@apantel

Description

@apantel

Describe the problem

It is not possible to add and drop an index (in either order) within the same transaction

To Reproduce

drop index foo cascade;
alter table t add constraint foo unique(x);
commit;
pq: index "foo" being dropped, try again later```

```root@:26257/defaultdb> begin;
alter table t add constraint foo unique(x);
drop index foo cascade;
commit;
pq: index "foo" in the middle of being added, try again later```

Setting `sql_safe_updates = FALSE` allows this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-schema-transactionalA-sql-pgcompatSemantic compatibility with PostgreSQLT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)X-anchored-telemetryThe issue number is anchored by telemetry references.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions