staging Functions
This page documents all 1 function(s) in the staging schema.
Function Index
| Function | Return Type | Language | Volatility | Security |
|---|---|---|---|---|
|
plpgsql |
VOLATILE |
purge_pending_users
Signature: staging.purge_pending_users()
Returns: void
Language |
plpgsql |
Volatility |
VOLATILE |
Strict |
No |
Security Definer |
No |
DECLARE
org_id INT;
intvl TEXT;
BEGIN
FOR org_id IN SELECT DISTINCT(home_ou) FROM staging.user_stage LOOP
SELECT INTO intvl value FROM
actor.org_unit_ancestor_setting(
'opac.pending_user_expire_interval', org_id);
CONTINUE WHEN intvl IS NULL OR intvl ILIKE 'null';
-- de-JSON-ify the string
SELECT INTO intvl TRIM(BOTH '"' FROM intvl);
DELETE FROM staging.user_stage
WHERE home_ou = org_id AND row_date + intvl::INTERVAL < NOW();
END LOOP;
END;