Eric B. Ridge wrote:
> gotcha. Stated differently, it's not volatile because, by design, it
> doesn't always produce the same output for the same input.
Right. But further, it doesn't even produce the same result within a
single scan. Here's from pg_proc.h:
/*
* Symbolic values for provolatile column: these indicate whether the
* result of a function is dependent *only* on the values of its
* explicit arguments, or can change due to outside factors (such as
* parameter variables or table contents). NOTE: functions having
* side-effects, such as setval(), must be labeled volatile to ensure
* they will not get optimized away, even if the actual return value is
* not changeable.
*/
#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */
#define PROVOLATILE_STABLE 's' /* does not change within a scan */
#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */
> OT: generate_series looks useful. Is this only in 7.5?
Yes, new in 7.5.
Joe