-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed age_id, age_start_id and age_end_id function signatures to IMMUTABLE #405
Conversation
Changed age_id(agtype), age_start_id(agtype) and age_end_id(agtype) from STABLE to IMMUTABLE.
The differences between STABLE and IMMUTABLE are small and have nothing to do with the database operations. Can you justify this change in the confines of STABLE versus IMMUTABLE? |
The case with these functions is that, through the arguments (a vertex or an edge or null), they receive all the data that is needed to give the wanted results, only doing processings that analyze its contents. By only processing the arguments passed to it, these functions will always return the same results based on these arguments, being classified as IMMUTABLE. If something would happen along the way (inside the function) that could change the result, like a scan in a modified database, it could be classified as STABLE. |
You are conflating STABLE with VOLATILE https://www.postgresql.org/docs/current/xfunc-volatility.html |
Sorry, I actually meant that, as an example of a stable function, a scan in the database could change its result, because the read data could be different in other calls of the function with the same arguments. That being said, these functions give results only based on the containers received as arguments (vertexes or edges), and nothing will act to change it in calls with the same arguments. For example, if I pass an edge with an id of 1, age_id will always look inside that edge container (not the database) and output 1, and in a similar way with the other two functions. |
@markgomer Please fix your commit log entry for the PR to be descriptive of the change - what was changed and why. Once this is corrected, let us know so that we can review the PR for merging. |
This reverts commit 92ac40d.
* Function signature was changed from STABLE to IMMUTABLE; * Function receives a vertex or edge container (or null), and analyze its contents to return the "id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function.
* Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "start_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function.
* Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "end_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function.
@jrgemignani I have updated the commit entry log for your review. Please let me know if these changes are appropriate. |
…MUTABLE (#405) * Changed some function signatures to IMMUTABLE Changed age_id(agtype), age_start_id(agtype) and age_end_id(agtype) from STABLE to IMMUTABLE. * Revert "Changed some function signatures to IMMUTABLE" This reverts commit 92ac40d. * Changed age_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives a vertex or edge container (or null), and analyze its contents to return the "id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function. * Changed age_start_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "start_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function. * Changed age_end_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "end_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function.
…MUTABLE (apache#405) * Changed some function signatures to IMMUTABLE Changed age_id(agtype), age_start_id(agtype) and age_end_id(agtype) from STABLE to IMMUTABLE. * Revert "Changed some function signatures to IMMUTABLE" This reverts commit 92ac40d. * Changed age_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives a vertex or edge container (or null), and analyze its contents to return the "id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function. * Changed age_start_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "start_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function. * Changed age_end_id signature to IMMUTABLE * Function signature was changed from STABLE to IMMUTABLE; * Function receives an edge container (or null), and analyze its contents to return the "end_id" stored in said container; * As it acts only on its arguments, it will always return the same result, given the same arguments, even across multiple SQL statements, being classified as IMMUTABLE function.
Changed age_id(agtype), age_start_id(agtype) and age_end_id(agtype) from STABLE to IMMUTABLE.
These functions only process the arguments passed to them, not doing any database scan. So they can be safely classified as immutable, instead of stable.