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?