First version of the dupe prevention trigger. Works for INSERTs and UPDATEs.
[mir.git] / dbscripts / dupetrigger / README
1 Dupe check Trigger
2 by Matthias "Trigger Hippy" Jordan <mjordan@code-fu.de>
3
4 The files in this directory are needed to create a PostgreSQL trigger that
5 is used to ensure that no comment and no article is posted twice. This
6 happens very often by accident and is very disturbing so we have to prevent
7 this somehow. Because Indymedia databases will hopefully grow big very fast,
8 we want to do this check as fast as possible. 
9
10 So Mir simply issues the INSERT. By this INSERT statement, a trigger gets,
11 well, triggered that calculate a CRC-32 checksum of the comment and searches
12 for rows with the same checksum. If it finds the checksum, the INSERT gets
13 aborted. If the checksum isn't found, it is appended to the row and the
14 INSERT is executed.
15
16 The trigger works for INSERTs and UPDATEs.