Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> so select my_random() a from my_table will return a list of the same singular random number (all values of a will be the same).

I suspect that you're mixing up stable and immutable. (Only immutable functions are evaluated at planning time.)



I may have gotten folding wrong. The question is whether the subquery gets run once at execution time and folded in, or whether it gets run on every row. I will have to double check the specific behavior but it's a query folding issue not a plan vs execution time issue.

As I think about it I may have gotten it wrong. It might need to be in a subquery to fold in that way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: