 <p>On a quick glance, I see a couple of instances of:</p> <pre><code>IF NEW.id_club = NULL ... </code></pre> <p>There may be more problems, I stopped looking there.<br> Nothing is <strong><em>ever</em></strong> the same as <code>NULL</code>. Use instead:</p> <pre><code>IF NEW.id_club <b>IS</b> NULL ...</code></pre> <p>Make sure you understand the nature of a <code>NULL</code> value, before you go on writing complex triggers. Basics first. <a href="http://www.postgresql.org/docs/current/interactive/functions-comparison.html" rel="nofollow">Start in the manual here</a>.</p>