       "loop_member_id_v"   "member"."id"%TYPE;
       "output_row"         "delegation_chain_row";
       "output_rows"        "delegation_chain_row"[];
+      "simulate_v"         BOOLEAN;
+      "simulate_here_v"    BOOLEAN;
       "delegation_row"     "delegation"%ROWTYPE;
       "row_count"          INT4;
       "i"                  INT4;
       "loop_v"             BOOLEAN;
     BEGIN
+      IF "simulate_trustee_id_p" NOTNULL AND "simulate_default_p" THEN
+        RAISE EXCEPTION 'Both "simulate_trustee_id_p" is set, and "simulate_default_p" is true';
+      END IF;
+      IF "simulate_trustee_id_p" NOTNULL OR "simulate_default_p" THEN
+        "simulate_v" := TRUE;
+      ELSE
+        "simulate_v" := FALSE;
+      END IF;
       IF
         "unit_id_p" NOTNULL AND
         "area_id_p" ISNULL AND

    "unit_id_p"             "unit"."id"%TYPE,
    "area_id_p"             "area"."id"%TYPE,
    "issue_id_p"            "issue"."id"%TYPE,
    "simulate_trustee_id_p" "member"."id"%TYPE DEFAULT NULL )
  RETURNS SETOF "delegation_chain_row"
  LANGUAGE 'plpgsql' STABLE AS $$
    DECLARE

    "unit"."id"%TYPE,
    "area"."id"%TYPE,
    "issue"."id"%TYPE,
    "member"."id"%TYPE,
    BOOLEAN )
  IS 'Notable information about a delegation chain for unit, area, or issue; See "delegation_info_type" for more information';


