{
  "db_name": "PostgreSQL",
  "query": "\n                    WITH result_stream AS (\n                        SELECT\n                            string_agg(stream, '' order by idx asc) as stream,\n                            job_id,\n                            max(idx) + 1 as offset\n                        FROM job_result_stream_v2\n                        WHERE job_id = $2 AND idx >= $3\n                        GROUP BY job_id\n                    )\n                    SELECT\n                        jc.result as \"result: sqlx::types::Json<Box<RawValue>>\",\n                        v2_job.tag,\n                        v2_job_queue.running as \"running: Option<bool>\",\n                        rs.stream AS \"result_stream: Option<String>\",\n                        rs.offset AS stream_offset,\n                        CASE WHEN $4 THEN NULL ELSE (COALESCE(js.flow_status, jc.flow_status)->>'stream_job')::uuid END as stream_job\n                    FROM v2_job\n                    LEFT JOIN v2_job_queue USING (id)\n                    LEFT JOIN v2_job_completed jc USING (id)\n                    LEFT JOIN v2_job_status js USING (id)\n                    LEFT JOIN result_stream rs ON rs.job_id = $2\n                    WHERE v2_job.id = $2 AND v2_job.workspace_id = $1",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "result: sqlx::types::Json<Box<RawValue>>",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 1,
        "name": "tag",
        "type_info": "Varchar"
      },
      {
        "ordinal": 2,
        "name": "running: Option<bool>",
        "type_info": "Bool"
      },
      {
        "ordinal": 3,
        "name": "result_stream: Option<String>",
        "type_info": "Text"
      },
      {
        "ordinal": 4,
        "name": "stream_offset",
        "type_info": "Int4"
      },
      {
        "ordinal": 5,
        "name": "stream_job",
        "type_info": "Uuid"
      }
    ],
    "parameters": {
      "Left": [
        "Text",
        "Uuid",
        "Int4",
        "Bool"
      ]
    },
    "nullable": [
      true,
      false,
      false,
      null,
      null,
      null
    ]
  },
  "hash": "6fa985751b0bd525e463472ae120a6b7f9dc556c1dfe0c3e89afcc623433b3b2"
}
