I need the right terminology for a particular type of function.
Suppose you write a function in your SQL database whose inputs and outputs are contained in the database transaction area.
That is, if you call this function in the database transaction area, all data used by this function is available in the same area. It can query the database table, but cannot read the file from the file system or ping of the website, etc. If you call the function twice in the same transaction with isolation REPEATABLE READ, you should get the same result, even if other clients make changes to the database.
Similarly, a function has no side effects except for the same transaction area. State changes that are outside the scope of the database transaction are not valid. The function should not send emails, write to the file system, or store the value in memcached, etc. If the function modifies the data in the database, this is normal, because if the calling transaction rolls back, then the function also has effects.
The arguments to the function are fine, as they are mostly used as constants.
What would be the appropriate term for a function of this type? The โdeterministic" does not really seem concrete enough. How would you describe this class of functions?
Thanks for your answers, but none of them are what I had in mind. Idempotent is getting closer, so I marked this as an accepted answer. But each of you has an increased percentage of me.
Pure functions have no side effects, and their result is based solely on their arguments. A result with the same arguments is always identical. This does not work, because the database functions that I mean can be based on the state of the data, and the function can also influence the state of the data.
. , ; , . , , , .