kitchen_sync icon indicating copy to clipboard operation
kitchen_sync copied to clipboard

Postgres unique index with expressions is incorrectly transferred

Open nefremov opened this issue 2 years ago • 1 comments

Hello, My source Postgres 11 db has the following index:

create unique index ix_permission_unique on permissions(tenant_id, name, coalesce(scope_type, ''), coalesce(scope_id, ''));

COALESCE expressions are used to allow NULL only once in nullable columns (Postgres 15 has NULLS NOT DISTINCT option for this)

in destination database kitchen_sync creates index:

create unique index ix_permission_unique on permissions(tenant_id, name);

omitting expressions.

This leads to obvious sync error duplicate key value violates unique constraint "ix_permission_unique".

UPD: destinasion db is Postgres 12. Source is synced to dedicated own db schema in destination db

nefremov avatar Feb 15 '23 07:02 nefremov

Yeah, not implemented yet unfortunately (https://github.com/willbryant/kitchen_sync/blob/main/SCHEMA.md#user-content-schema-things-currently-ignored).

willbryant avatar Feb 17 '23 00:02 willbryant