Duplicate values in columns with a unique constraint
----------------------------------------------------
Key: CORE-5694
URL: http://tracker.firebirdsql.org/browse/CORE-5694
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 3.0.2
Environment: Debian/unstable on amd64, firebird3.0 package version
3.0.2.32703.ds4-12
SuperServer, SuperClassic and Classic, forced writes ON and OFF, sweep disabled
or 20000
Reporter: Damyan Ivanov
Attachments: fb-dupl-uniq.fbk.gz
It is possible to get rows with duplicate values in columns with a unique
constraint.
Sample database backup is in fb-dupl-uniq.fbk.gz
Notice the unique constraint on test(obj_id, prj_id) and the procedure
add_obj_to_prj which inserts records in TEST ignoring constraint violation.
That procedure is invoked by an after update/insert trigger of table OBJ.
To trigger the problem, run the following shell command:
(triggers updates in 5000 rows, in random order, in 6 parallel processes)
for j in $(seq 1 6); do ( ( for i in $(seq 1 5000); do echo $i; done | shuf |
while read i; do printf "update obj set data='Object %d' where id='911%07d';\n
commit;\n" $i $i; done ) | isql-fb
localhost:/var/lib/firebird/3.0/data/test.fdb ) &; done
there may be some update conflicts, but that's irrelevant -- I see the problem
even when there are no update conflicts.
The above may need to be run several times, or the process count to be
increased to surpass the number of CPU cores.
Execute the following SQL to see if the problem is there:
select obj_id, prj_id, count(*) from test
group by 1,2
having count(*) > 1;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel