Package: firebird3.0-server-core
Version: 3.0.1.32609.ds4-14
Severity: important
Tags: patch upstream fixed-upstream

Control: forwarded -1 http://tracker.firebirdsql.org/browse/CORE-5694

Copied from upstream bug report:

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;

Attachment: fb-dupl-uniq.fbk.gz
Description: application/gzip

Reply via email to