-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Partial index uniqueness violation #8084
Comments
Should be fixed in master now, please check next build |
The case given in the ticket works correctly. But the opposite case, when the column in the filtering condition is changed so that the record no longer falls into the index key, does not work. If you do everything the same as before and then this
|
Simplified version of the second case RECREATE TABLE T1 (
ID BIGINT NOT NULL,
A BIGINT NOT NULL,
B SMALLINT NOT NULL,
CONSTRAINT PK_T1 PRIMARY KEY(ID)
);
CREATE UNIQUE INDEX IDX_T1_A ON T1(A) WHERE (B = 1);
INSERT INTO T1(ID, A, B) VALUES (1, 1, 0);
INSERT INTO T1(ID, A, B) VALUES (2, 2, 1);
INSERT INTO T1(ID, A, B) VALUES (3, 1, 0);
COMMIT;
UPDATE T1 SET B=0;
COMMIT;
INSERT INTO T1(ID, A, B) VALUES (4, 2, 1); /* Error */ |
Pavel the bug is not completely fixed. Only one special case has been fixed. Perhaps you need to change the description of the error. It is not about a violation of uniqueness, but about the fact that changes in the columns participating in the partial index filtering condition are not tracked. It's just easy to see with unique indexes. |
I see, thanks. Working on fixing it. |
Note, IndexCondition instances was moved into own scope to avoid "Attempt to evaluate index condition recursively" error.
After the latest fix (version 6.0.0.325), partial indexes work without errors. Please make a fix for 5.0 as well. |
Note, IndexCondition instances was moved into own scope to avoid "Attempt to evaluate index condition recursively" error.
Done, thanks for testing. |
Reproduce in Firebird 5.0.1.1381
Now let's try to break the uniqueness.
Thus, if the filtering field of a partial index is not included in the index key, then its uniqueness can be easily violated by updating the filtering field. This breaks backup/restore and index rebuilding.
The text was updated successfully, but these errors were encountered: