Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres unique index with expressions is incorrectly transferred #113

Open
nefremov opened this issue Feb 15, 2023 · 1 comment
Open

Postgres unique index with expressions is incorrectly transferred #113

nefremov opened this issue Feb 15, 2023 · 1 comment

Comments

@nefremov
Copy link

nefremov commented Feb 15, 2023

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

@willbryant
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants