Newbie questions. I'm working on a MySQL project that will use only row-level binary logging. There will be no replication. Since logging is row-level, does it even matter if a function is deterministic? From the manual, my understanding is that it does not.
I've added an example which I think would be non-deterministic; please tell me if I'm wrong. The result will always be the same for a given state of the data, returning the highest date value in a set of rows, but would not always return the same value for the same input of a given patient id, since that changes over time. Is that right?
CREATE FUNCTION `last_enc_date`(patient INT) RETURNS date BEGIN # Returns the date of the most recent encounter (of any kind) for patient DECLARE lastvisit DATE; SELECT MAX(DATE) INTO lastvisit FROM encounters WHERE personid = patient; RETURN lastvisit; END