Comment 1 for bug 1081551

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Hello Eva.

This bug has been reported at other sites, too. A technical note follows to guide the development of a future patch.

serial.unit is a child table of asset.copy. Each table has a unique constraint for the "barcode" field (when the "deleted" field is false, anyway). These constraints do not prevent the duplicates between two rows if one row is only in asset.copy and the other is in serial.unit, due to a PostgreSQL limitation that I didn't appreciate when I wrote the serials batch receive code.

The "safest" fix, from the point of view of providing the best guarantee of future data integrity, may be a trigger on INSERT or UPDATE operations to serial.unit that tests for the presence of the incoming barcode explicitly, and raises an exception when found.