Functions
File location: schema/functions/<name>.yaml
Example
Section titled “Example”name: update_timestamplanguage: plpgsqlreturns: triggerargs: - name: target_column type: text mode: IN default: "'updated_at'"body: | BEGIN NEW.updated_at = now(); RETURN NEW; END;security: invokervolatility: volatileparallel: unsafestrict: falseleakproof: falsecost: 100rows: 0set: search_path: publicgrants: - to: app_user privileges: [EXECUTE]comment: 'Auto-update timestamp trigger function'Fields
Section titled “Fields”Required
Section titled “Required”| Field | Type | Description |
|---|---|---|
name | string | Function name |
language | string | plpgsql, sql, etc. |
returns | string | Return type (trigger, void, text, integer, SETOF record, etc.) |
body | string | Function body |
Optional
Section titled “Optional”| Field | Type | Default | Description |
|---|---|---|---|
args | object[] | [] | Function arguments |
security | string | invoker | invoker or definer |
volatility | string | volatile | volatile, stable, or immutable |
parallel | string | unsafe | unsafe, safe, or restricted |
strict | boolean | false | RETURNS NULL ON NULL INPUT |
leakproof | boolean | false | Leakproof flag |
cost | number | — | Estimated execution cost |
rows | number | — | Estimated rows for set-returning functions |
set | object | — | Configuration parameters (SET key = value) |
grants | object[] | — | Function-level grants |
comment | string | — | Description |
Arguments
Section titled “Arguments”args: - name: user_id type: uuid mode: IN # IN (default) | OUT | INOUT | VARIADIC default: null # optional default valueGrants
Section titled “Grants”grants: - to: app_user privileges: [EXECUTE]Behavior
Section titled “Behavior”Functions are created with CREATE OR REPLACE FUNCTION. When any property changes (body, args, return type, security, volatility, etc.), the function is replaced.