a506867e4df8c45590cf82e03173a9f262198340
[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 calculates a CRC-32 checksum of the comment and
12 searches for rows with the same checksum. If it finds the checksum, the
13 INSERT gets aborted. If the checksum isn't found, it is appended to the row
14 and the INSERT is executed.
15
16 The trigger works for INSERTs and UPDATEs.