title: To ignore result in BEFORE TRIGGER of PostgreSQL?
body: <p>This thread is a part challenge of this <a href="https://stackoverflow.com/q/31533496/54964">thread</a> to which I am searching a better solution for one part by BEFORE TRIGGER. 
  I just want to launch a trigger to convert to correct brackets. 
  I am thinking whether I should return from the trigger NULL or something else in before trigger. </p>
  
  <p>Code</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION insbef_events_function() 
      RETURNS TRIGGER AS 
  $func$
  DECLARE
      m int[]; 
  BEGIN
     FOREACH m SLICE 1 IN ARRAY TG_ARGV[0]::int[]
     LOOP
        INSERT INTO events (measurement_id, event_index_start, event_index_end) 
        SELECT NEW.measurement_id, m[1], m[2];  -- Postgres array starts with 1 !
     END LOOP;
  
        -- do something with _result ...
  
  RETURN NULL; -- result ignored since this is an BEFORE trigger TODO right?
  END 
  $func$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>which I use the by the function  </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION f_create_my_trigger_events(_arg1 int, _arg2 text, _arg3 text)
    RETURNS void AS
  $func$
  BEGIN
  
  EXECUTE format($$
      DROP TRIGGER IF EXISTS insbef_ids ON events
      CREATE TRIGGER insbef_ids
      BEFORE INSERT ON events
      FOR EACH ROW EXECUTE PROCEDURE insbef_events_function(%1$L)$$
      , translate(_arg2, '[]', '{}'), translate(_arg3, '[]', '{}')
  );
  
  END
  $func$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>I am unsure about this line: <code>RETURN NULL; -- result ignored since this is an</code>BEFORE<code>trigger TODO right?</code>, since I think this is the case in <code>AFTER</code> trigger but not in before trigger.<br>
  I just want to launch a trigger to convert correct brackets. </p>
  
  <p>Test command is <code>sudo -u postgres psql detector -c "SELECT f_create_my_trigger_events(1,'[112]','[113]');"</code> getting the following error because of misunderstanding of the returning -thing, I think. </p>
  
  <blockquote>
  <pre><code>LINE 3:     CREATE TRIGGER insbef_ids
              ^
  QUERY:  
      DROP TRIGGER IF EXISTS insbef_ids ON events
      CREATE TRIGGER insbef_ids
      BEFORE INSERT ON events
      FOR EACH ROW EXECUTE PROCEDURE insbef_events_function('{112}')
  CONTEXT:  PL/pgSQL function f_create_my_trigger_events(integer,text,text) line 4 at EXECUTE statement
  </code></pre>
  </blockquote>
  
  <p>How can you manage <code>BEFORE</code> triggers in PostgreSQL 9.4?</p>