what does “LANGUAGE 'plpgsql' VOLATILE” mean?

喜你入骨 提交于 2019-12-05 13:06:48
Akash KC

From Postgres docs:

VOLATILE indicates that the function value can change even within a single table scan, so no optimizations can be made. Relatively few database functions are volatile in this sense; some examples are random(), currval(), timeofday(). But note that any function that has side-effects must be classified volatile, even if its result is quite predictable, to prevent calls from being optimized away; an example is setval().

Erwin Brandstetter

Not least, LANGUAGE 'plpgsql' VOLATILE means that somebody didn't get the memo.

The language name in CREATE FUNCTION is an identifier and should not be quoted. Should be:

LANGUAGE plpgsql VOLATILE

Malpractice can lead to confusing errors. More details in this related answer:
PostgreSQL procedural language "C" not found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!