pgdiff
pgdiff copied to clipboard
Exclusion index support
Currently pgdiff outputs wrong migration for exclusion indexes, as it does not detect it's a special case. This is a generalization of unique constraint, a bit more info here -- https://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION
Setup DB1:
create extension btree_gist;
create table foo (a integer, b integer);
alter table foo add constraint foo_eidx exclude using gist (a with =, b with !=);
Setup DB2:
create extension btree_gist;
create table foo (a integer, b integer);
Output for INDEX:
./pgdiff -D db1 -d db2 -U user -u user -W xxx -w xxx INDEX
-- schemaType: INDEX
-- db1: {db1 localhost 5432 user xxx * sslmode=disable}
-- db2: {db2 localhost 5432 user xxx * sslmode=disable}
-- Run the following SQL against db2:
CREATE INDEX foo_eidx ON foo USING gist (a, b)