CREATE OR REPLACE FUNCTION miq_queue_before()
  RETURNS trigger AS
$BODY$
      BEGIN
		   IF NEW.task_id LIKE 'service_template_provision_task_%' THEN
                NEW.msg_timeout = 1800 ;
           END IF;
      RETURN NEW;

      END;
      $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION miq_queue_before()
  OWNER TO root;


-- Trigger: miq_queue_before on metrics

-- DROP TRIGGER miq_queue_before ON miq_queue;

CREATE TRIGGER miq_queue_before
  BEFORE INSERT
  ON miq_queue
  FOR EACH ROW
  EXECUTE PROCEDURE miq_queue_before();