                 "output_row"."participation" := NULL;
               END IF;
             END IF;
-            SELECT * INTO "delegation_row" FROM "delegation"
-              WHERE "truster_id" = "output_row"."member_id"
-              AND (
-                "unit_id" = "unit_id_v" OR
-                "area_id" = "area_id_v" OR
-                "issue_id" = "issue_id_p"
-              )
-              ORDER BY "scope" DESC;
+            IF "simulate_here_v" THEN
+              IF "simulate_trustee_id_p" ISNULL THEN
+                SELECT * INTO "delegation_row" FROM "delegation"
+                  WHERE "truster_id" = "output_row"."member_id"
+                  AND (
+                    "unit_id" = "unit_id_v" OR
+                    "area_id" = "area_id_v"
+                  )
+                  ORDER BY "scope" DESC;
+              END IF;
+            ELSE
+              SELECT * INTO "delegation_row" FROM "delegation"
+                WHERE "truster_id" = "output_row"."member_id"
+                AND (
+                  "unit_id" = "unit_id_v" OR
+                  "area_id" = "area_id_v" OR
+                  "issue_id" = "issue_id_p"
+                )
+                ORDER BY "scope" DESC;
+            END IF;
           END IF;
         ELSE
-          "output_row"."member_valid"  := FALSE;
           "output_row"."participation" := FALSE;
-          "output_row"."scope_out"     := NULL;
-          "delegation_row" := ROW(NULL);
         END IF;
-        IF
-          "output_row"."member_id" = "member_id_p" AND
-          "simulate_trustee_id_p" NOTNULL
-        THEN
+        IF "simulate_here_v" AND "simulate_trustee_id_p" NOTNULL THEN
           "output_row"."scope_out" := "scope_v";
           "output_rows" := "output_rows" || "output_row";
           "output_row"."member_id" := "simulate_trustee_id_p";

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



      "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
