now() date/time function used to
set the current time in the integer time column in a . Many policies only apply to
s of a certain age. integer_now_func determines the age of each .
The function you set as integer_now_func has no arguments. It must be either:
-
IMMUTABLE: Use when you execute the query each time rather than prepare it prior to execution. The value forinteger_now_funcis computed before the plan is generated. This generates a significantly smaller plan, especially if you have a lot of s. -
STABLE:integer_now_funcis evaluated just before query execution starts. pruning is executed at runtime. This generates a correct result, but may increase planning time.
set_integer_now_func does not work on tables where the time column type is TIMESTAMP, TIMESTAMPTZ, or
DATE.
Samples
Set the integernow function for a with a time column in unix time.
-
IMMUTABLE: when you execute the query each time: -
STABLE: for prepared statements:
Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
main_table | REGCLASS | - | ✔ | The integer_now_func is used in. |
integer_now_func | REGPROC | - | ✔ | A function that returns the current time set in each row in the time column in main_table. |
replace_if_exists | BOOLEAN | FALSE | ✖ | Set to true to override integer_now_func when you have previously set a custom function. |