title: String concatenation within an exception
body: <p>In my trigger procedures I use RAISE EXCEPTION for messages. I have no problem with simple messages, but if I want to give the user some more complex feedback, I face a problem: the concatenation operator doesn't work within RAISE EXCEPTION statement.</p>
  
  <p>First, I tried this:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION hlidej_datum_kon() RETURNS trigger AS $$
  DECLARE
    od date;
  BEGIN
    SELECT a.datum_od FROM akce AS a WHERE a.kod_akce = (
      SELECT b.kod_akce FROM sj AS b WHERE b.kod_sj = NEW.kod_sj
    ) INTO od;
    IF NEW.datum &lt; od THEN
      RAISE EXCEPTION 'Kontext nemohl být odkryt před začátkem akce ('||TO_CHAR(od)||')!'
      ROLLBACK;  
    END IF;
    RETURN NEW;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>Didn't work. So I tried to put the whole text to a text variable, but I didn't find how to put the variable's contents to the exception statement so that it would be printed as a message.</p>
  
  <p>My question is: <strong>how to print a message containing variables in a PostgreSQL trigger function?</strong></p>
  
  <p>Just for sake of completeness, here is my trigger:</p>
  
  <pre><code>CREATE TRIGGER hlidej_datum_kon
  AFTER INSERT OR UPDATE ON kontext
  FOR EACH ROW
    EXECUTE PROCEDURE hlidej_datum_kon();
  END;
  </code></pre>