Getting multiple migration statements working in a migration file with migratus

I am using migratus for managing migrations. This line talks about handling multiple migration statements in a single file. I tried using --;; between each statement like it’s given in the link. But I still end up getting

Execution error (PSQLException) at org.postgresql.jdbc.BatchResultHandler/handleCommandStatus (BatchResultHandler.java:92).
Too many update results were returned.

My migration file

CREATE INDEX foo ON baz USING GIN(col1); -- GIN Index (array)
--;;
CREATE INDEX foo1 ON baz USING GIN(col2); -- GIN Index (array)
--;;
CREATE INDEX foo2 ON baz USING GIN(col3); -- GIN Index (array)
--;;

Am I doing something wrong?

Perhaps try wrapping the statements in a transaction?

tried, I get the same error.

The issue is apparently with a single CREATE INDEX with GIN statement returning multiple rows. The solution suggested (and works) is to wrap each statement in a DO block this way

DO
$$
    BEGIN
    [... your statement here ...]
    END
$$;
1 Like

Glad you found a solution! Sorry there wasn’t much help to get here :slight_smile: