Skip to content

Commit aafb31a

Browse files
committed
use lateral subquery
1 parent ddc81b7 commit aafb31a

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

coderd/database/queries.sql.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,14 +708,15 @@ LEFT JOIN LATERAL (
708708
ORDER BY build_number DESC
709709
LIMIT 1
710710
) latest_build ON true
711-
LEFT JOIN (
711+
LEFT JOIN LATERAL (
712712
SELECT
713713
workspace_agents.id as agent_id,
714714
workspace_agents.name as agent_name,
715715
job_id
716716
FROM workspace_resources
717717
JOIN workspace_agents ON workspace_agents.resource_id = workspace_resources.id
718-
) resources ON resources.job_id = latest_build.job_id
718+
WHERE job_id = latest_build.job_id
719+
) resources ON true
719720
WHERE
720721
-- Filter by owner_id
721722
workspaces.owner_id = @owner_id :: uuid

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy