Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have created CREATE INDEX scripts using the indexdef column of pg_indexes in one database and tried to run the script on another database.

When each line of the script is executed separately it runs successfully, however if I try to run all together I get an error that index already exists.

Can someone help me understand what the problem could be?

share|improve this question

closed as too localized by JNK Sep 4 '12 at 20:20

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
If Postgres tells you "index already exists" then that's probably the case. The question is: why would the index exist already? Can you provide an exact (short) example that fails and the exact error message that comes with it? Also, your version of Postgres. –  Erwin Brandstetter Sep 4 '12 at 19:39

Browse other questions tagged or ask your own question.