title: mysql error when adding function
body: <p>The following error is returned when trying to use a MySQL function..</p>
  
  <pre><code>#1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its
  declaration and binary logging is enabled (you *might* want to use the less safe 
  log_bin_trust_function_creators variable) 
  </code></pre>
  
  <p>I couple of days ago I started using replication..? Don't know if this could have an incluence on it?! But I know one thing - it has worked :)</p>
  
  <p>If I try to override (add the function again) the same error occurs..</p>
  
  <p>The function</p>
  
  <pre><code>DELIMITER $$
  
  DROP FUNCTION IF EXISTS `stock_in_stock_ids` $$
  CREATE DEFINER=`dynaccount`@`localhost` FUNCTION `stock_in_stock_ids`(_running_total_limit INT, _product_id INT, _group_id INT) RETURNS TEXT
  BEGIN
      DECLARE done INT DEFAULT FALSE;
      DECLARE _running_count INT default 0;
      DECLARE _id INT;
      DECLARE _count INT;
      DECLARE _ids TEXT DEFAULT NULL;
  
      DECLARE _cur CURSOR FOR SELECT id, count FROM stock WHERE group_id=_group_id &amp;&amp; type=2 &amp;&amp; product_id=_product_id ORDER BY time DESC, id DESC;
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
  
      OPEN _cur;
  
      read_loop: LOOP
          FETCH _cur INTO _id, _count;
  
          IF done THEN
              SET _ids = '0';
              LEAVE read_loop;
          END IF;
  
          SET _running_count = _running_count + _count;
          SET _ids = CONCAT_WS(',', _ids, _id);
  
          IF _running_count &gt;= _running_total_limit THEN
              LEAVE read_loop;
          END IF;
      END LOOP read_loop;
  
      CLOSE _cur;
  
      RETURN _ids;
  END $$
  
  DELIMITER ;
  </code></pre>