You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[call.route]
query=SELECT * FROM forking_route('${called}');
result=location
priority=90
namevaluepairs=yes
Routing function example (requires HSTORE postgresql extension):
CREATE OR REPLACE FUNCTION forking_route(called_arg TEXT) RETURNS TABLE(key TEXT, value TEXT) AS $$
DECLARE
res HSTORE;
cntr INTEGER;
BEGIN
.......
res := 'location => fork';
cntr := 0;
FOR t IN SELECT * FROM .......... LOOP
cntr := cntr + 1;
res := res || hstore('callto.' || cntr, t.location);
FOR kvp IN SELECT * FROM EACH(t.route_params) LOOP
res := res || hstore('callto.' || cntr || '.' || kvp.key, kvp.value);
END LOOP;
END LOOP;
...
RETURN QUERY SELECT * FROM each(res);
END;
$$ LANGUAGE PlPgSQL;