{ "db_name": "PostgreSQL", "query": "\n WITH project_ids AS (\n SELECT unnest($1::bigint[]) AS project_id\n )\n SELECT\n p.project_id AS \"project_id!: DBProjectId\",\n EXISTS(\n SELECT 1\n FROM delphi_issue_details_with_statuses didws\n INNER JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n WHERE\n didws.project_id = p.project_id\n AND didws.status = 'pending'\n AND dri.issue_type != $3\n ) AS \"has_pending_detail!\",\n EXISTS(\n SELECT 1\n FROM delphi_issue_details_with_statuses didws\n INNER JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n WHERE\n didws.project_id = p.project_id\n AND didws.status = 'unsafe'\n AND dri.issue_type != $3\n ) AS \"has_unsafe_detail!\",\n EXISTS(\n SELECT 1\n FROM delphi_issue_details_with_statuses didws\n INNER JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n WHERE\n didws.project_id = p.project_id\n AND didws.status = 'pending'\n AND dri.issue_type = $3\n ) AS \"has_dummy!\",\n (\n SELECT t.id\n FROM threads t\n WHERE t.mod_id = p.project_id\n ORDER BY t.id\n LIMIT 1\n ) AS \"thread_id: DBThreadId\",\n (\n SELECT tm.body->>'type'\n FROM threads t\n INNER JOIN threads_messages tm ON tm.thread_id = t.id\n WHERE\n t.mod_id = p.project_id\n AND tm.body->>'type' = ANY($2::text[])\n ORDER BY tm.created DESC, tm.id DESC\n LIMIT 1\n ) AS \"last_tech_review_message_type\",\n (\n SELECT dr.id\n FROM versions v\n INNER JOIN files f ON f.version_id = v.id\n INNER JOIN delphi_reports dr ON dr.file_id = f.id\n WHERE v.mod_id = p.project_id\n ORDER BY dr.created DESC, dr.id DESC\n LIMIT 1\n ) AS \"report_id: DelphiReportId\"\n FROM project_ids p\n ", "describe": { "columns": [ { "ordinal": 0, "name": "project_id!: DBProjectId", "type_info": "Int8" }, { "ordinal": 1, "name": "has_pending_detail!", "type_info": "Bool" }, { "ordinal": 2, "name": "has_unsafe_detail!", "type_info": "Bool" }, { "ordinal": 3, "name": "has_dummy!", "type_info": "Bool" }, { "ordinal": 4, "name": "thread_id: DBThreadId", "type_info": "Int8" }, { "ordinal": 5, "name": "last_tech_review_message_type", "type_info": "Text" }, { "ordinal": 6, "name": "report_id: DelphiReportId", "type_info": "Int8" } ], "parameters": { "Left": [ "Int8Array", "TextArray", "Text" ] }, "nullable": [ null, null, null, null, null, null, null ] }, "hash": "bb94018c84f3809b9ad89f35ff08501addc8f203a0a152346aaebd32db52be30" }