title: PostgreSQL trigger won't inset audit value
body: <p>I'm working with PostgreSQL 8.1 and I created a trigger for a table, so if something gets updated or inserted it will be also registered in a log table, but I'm having issues with NULL values:</p>
  
  <p>If I update a column with a NULL value, then it won't insert any value to the log, but with char to char it will be fine, so maybe I'm missing something. </p>
  
  <p>The table was created like this:</p>
  
  <pre><code>CREATE TABLE log_test(
  
      id_test         integer   NOT NULL DEFAULT nextval('id_test_seq'),
      type         char(3),
      product         char(10),
      table             char(15),
      field            char(10),
      old_val            char(10),
      new_val            char(10),
      user            char(10),
      event            char(10),
      date           timestamp with time zone      NOT NULL DEFAULT now(),
   CONSTRAINT "log_test_prim" PRIMARY KEY ("id_test")
  );
  </code></pre>
  
  <p>The trigger was created like:</p>
  
  <pre><code>CREATE FUNCTION "public"."log_test_trigger" () RETURNS "trigger" AS 'BEGIN
  ...
     IF (TG_OP = ''UPDATE'') THEN
              IF (NEW.name &lt;&gt; OLD.name) THEN
                     INSERT INTO log_test (type, table, field, old_val, new_val, user, event) VALUES (NEW.type,  TG_RELNAME, ''name'', OLD.name, NEW.name, NEW.user, ''UPDATE'');
              END IF;
  ...
  END;' LANGUAGE "plpgsql"
  VOLATILE
  CALLED ON NULL INPUT
  SECURITY INVOKER
  </code></pre>
  
  <p>Any help?</p>