Closed ivanovv closed 9 years ago
My bad, must read the docs
If a constraint name is provided then the index will be renamed to match the constraint name. Otherwise the constraint will be named the same as the index.
Closing.
Sorry for not replying for do long, was on vacation. Right, it is renamed automatically when creating constraint, so no intentional renaming needed.
command run:
./pgcompact --dbname dbname --table tablename -u --reindex
output (non relevant parts were skipped):
What bothers me here is that we have
ALTER TABLE schema_name.tablename ADD CONSTRAINT tablename_pkey PRIMARY KEY USING INDEX pgcompact_index_26822; -- dbname
and on the next lineCREATE UNIQUE INDEX CONCURRENTLY pgcompact_index_26822 ON schema_name.tablename USING btree (date_id, customer_subscription_id); -- dbname
So, we used an index as a PK and then try to create the index with the same name, but with another set of columns. It won't be the issue with other cases as that temp index name is used to swap indices and dropped later, but in the case with PK seems like an error in the script.