Skip to content

Commit 71c44e7

Browse files
committed
use lateral subquery
1 parent ac9bc72 commit 71c44e7

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
@@ -711,14 +711,15 @@ LEFT JOIN LATERAL (
711711
ORDER BY build_number DESC
712712
LIMIT 1
713713
) latest_build ON true
714-
LEFT JOIN (
714+
LEFT JOIN LATERAL (
715715
SELECT
716716
workspace_agents.id as agent_id,
717717
workspace_agents.name as agent_name,
718718
job_id
719719
FROM workspace_resources
720720
JOIN workspace_agents ON workspace_agents.resource_id = workspace_resources.id
721-
) resources ON resources.job_id = latest_build.job_id
721+
WHERE job_id = latest_build.job_id
722+
) resources ON true
722723
WHERE
723724
-- Filter by owner_id
724725
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