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

DeActivate/Activate INDEX or RESTORE not possible with NULL in unique index. [CORE3937] #4270

Closed
firebird-automations opened this issue Sep 26, 2012 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Bjarne Rasmussen (bimmer_r)

Duplicates CORE3675

1) create empty database (or just use any test db at hand)
2) Run script :

SET SQL DIALECT 3;
CREATE GENERATOR GEN_NEW_TABLE_ID;
CREATE TABLE TESTTABLE (
ID INTEGER NOT NULL,
FIELD1 INTEGER NOT NULL,
FIELD2 INTEGER NOT NULL,
FIELD3 VARCHAR(10),
FIELD4 VARCHAR(10)
);
ALTER TABLE TESTTABLE ADD CONSTRAINT PK_TESTTABLE PRIMARY KEY (ID);
CREATE UNIQUE INDEX TESTTABLE_IDX1 ON TESTTABLE (FIELD1, FIELD2, FIELD3, FIELD4);
ALTER INDEX TESTTABLE_IDX1 INACTIVE;
SET TERM ^ ;
/* Trigger: TESTTABLE_BI */
CREATE OR ALTER TRIGGER TESTTABLE_BI FOR TESTTABLE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (http://NEW.id IS NULL) THEN
http://NEW.id = GEN_ID(gen_new_table_id,1);
END
^
SET TERM ; ^
3) Table is created with KEY, INDEX, GENERATOR and a Trigger ... lets put some data in.

INSERT INTO TESTTABLE (FIELD1, FIELD2, FIELD3, FIELD4) VALUES (1, 2, NULL, NULL);
INSERT INTO TESTTABLE (FIELD1, FIELD2, FIELD3, FIELD4) VALUES (1, 2, '', '');
COMMIT WORK;

4) Now we are ready to test the INDEX.
a. DeActivate index : ALTER INDEX TESTTABLE_IDX1 INACTIVE. (result is OK)
b. Activate index : ALTER INDEX TESTTABLE_IDX1 ACTIVE. <--------------------------- THIS FAILS ??????

Error is : "attempt to store duplicate value(visible to active transactions) in unique index "TESTTABLE_IDX1".

====== Test Details ======

Could NOT reproduce error on WI-V2.5.1.26351 (SuperClassic).

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Reproduced in 2.5.1
Not reproduced in 2.5.0, 2.5.2 RC1, current 2.5.3
Looks like regression introduced in 2.5.1 and already fixed in 2.5.2

Could you try 2.5.2 and confirm ?

@firebird-automations
Copy link
Collaborator Author

Commented by: Bjarne Rasmussen (bimmer_r)

Tested i 2.5.2 RC1 - and it works !!

Thx. Vlad

@firebird-automations
Copy link
Collaborator Author

Commented by: Bjarne Rasmussen (bimmer_r)

Test process:

Base backup was done in existing 2.5.1

Restore on a stand alone windows 7 - 64 bit - (32 bit FireBird 2.5.2 RC1).

Restore with 2.5.2 GBAK : OK.
Restore with IBExpert 2011.12.13 (old version) : OK.
Restore with FlameRobing 0.93.2219 (latest version) : OK.

Hope this explains my test a bit more :-)

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue duplicates CORE3675 [ CORE3675 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done with caveats

Test Details: Could NOT reproduce error on WI-V2.5.1.26351 (SuperClassic).

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

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

1 participant