Skip to content

Functions

File location: schema/functions/<name>.yaml

name: update_timestamp
language: plpgsql
returns: trigger
args:
- name: target_column
type: text
mode: IN
default: "'updated_at'"
body: |
BEGIN
NEW.updated_at = now();
RETURN NEW;
END;
security: invoker
volatility: volatile
parallel: unsafe
strict: false
leakproof: false
cost: 100
rows: 0
set:
search_path: public
grants:
- to: app_user
privileges: [EXECUTE]
comment: 'Auto-update timestamp trigger function'
FieldTypeDescription
namestringFunction name
languagestringplpgsql, sql, etc.
returnsstringReturn type (trigger, void, text, integer, SETOF record, etc.)
bodystringFunction body
FieldTypeDefaultDescription
argsobject[][]Function arguments
securitystringinvokerinvoker or definer
volatilitystringvolatilevolatile, stable, or immutable
parallelstringunsafeunsafe, safe, or restricted
strictbooleanfalseRETURNS NULL ON NULL INPUT
leakproofbooleanfalseLeakproof flag
costnumberEstimated execution cost
rowsnumberEstimated rows for set-returning functions
setobjectConfiguration parameters (SET key = value)
grantsobject[]Function-level grants
commentstringDescription
args:
- name: user_id
type: uuid
mode: IN # IN (default) | OUT | INOUT | VARIADIC
default: null # optional default value
grants:
- to: app_user
privileges: [EXECUTE]

Functions are created with CREATE OR REPLACE FUNCTION. When any property changes (body, args, return type, security, volatility, etc.), the function is replaced.