Re: PG Bug reporting form 2019-03-21 <15710-f52bad04543be4cb(at)postgresql(dot)org>
> CREATE TABLE test (id SERIAL PRIMARY KEY);
> ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer UNIQUE;
As a workaround, you can name the constraint:
ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer CONSTRAINT id_unique UNIQUE;
Then it won't get added multiple times. (It will still be executed
once, though.)
Christoph