As reported by Andreas Beckmann in Debian Bug #861077, applying the pgsql-upgrade-1.13.0.sql upgrade script fails when the database was created with an old schema (1.0.2 in this case):
ERROR: constraint "uq_servicedependencies" of relation "icinga_servicedependencies" does not exist
The old pgsql.sql script didn't create the UNIQUE CONSTRAINT with an explicit name as expected by the upgrade script.
Using DROP CONSTRAINT ... IF EXISTS solves this issue, along with conditionally dropping the automatically named constraint from the old schema.
As reported by Andreas Beckmann in Debian Bug #861077, applying the
pgsql-upgrade-1.13.0.sql
upgrade script fails when the database was created with an old schema (1.0.2 in this case):The old
pgsql.sql
script didn't create the UNIQUE CONSTRAINT with an explicit name as expected by the upgrade script.Using
DROP CONSTRAINT ... IF EXISTS
solves this issue, along with conditionally dropping the automatically named constraint from the old schema.