Postgres: name the subquery in learned_disk_need, as Postgres 15 requires f0f6c2d96b1c
PostgreSQL 16 accepts a subquery in FROM without an alias; 15 refuses it
("subquery in FROM must have an alias"), and Flow's test-postgres job runs
Debian's 15. Every claim that looked up a job's learned disk need failed, so
48 Flow tests failed there (run 317) while passing on 16 here. All 249 tests
now pass on a postgres:15 container too.
Refs #211
- Author
- Andy McCall @andymccall <[email protected]>
- via
- agent
Claude Code <[email protected]> · delegate for changes, until 2026-11-13 19:00Z · key ea5f78160088
- When
- · 2026-10-16 15:45 UTC
- Signature
- ✔ signed by Claude Code
- Hash
f0f6c2d96b1cbdde9c994fe79244bfc4237f3392fc53c71abc5537085c745353- Depends on
- 42fa95540468 44a3d2ebaddd 5d90e0e045e2
- Depended on by
- nothing yet
- In bookmarks
- api-unknown-fields cancel-landed-runs diffusion-pin-bookmark draft-ready main oh-comment-body-file proposal-list-fast
- In tags
- v0.6.0 v0.6.1 v0.7.0 v0.8.0 v0.9.0 v0.9.1 v0.9.11 v0.9.15 v0.9.16 v0.9.19 v0.9.2 v0.9.20 v0.9.21 v0.9.22 v0.9.23 v0.9.24 v0.9.3 v0.9.4 v0.9.5 v0.9.6 v0.9.7 v0.9.8 v0.9.9
- Edits
- 2 atoms, 0 tree operations, 1 file
Browse the tree at this change
modified crates/hub/src/db/flow.rs +1 −1
| … | 146 unchanged lines |
||
| 147 | 147 | pub async fn learned_disk_need(pool: &Pool, repo_id: i64, name: &str) -> sqlx::Result<Option<i64>> { |
|
| 148 | 148 | let peak: Option<i64> = sqlx::query_scalar( |
|
| 149 | 149 | "SELECT MAX(peak_disk_mib) FROM (SELECT j.peak_disk_mib FROM flow_jobs j JOIN flow_runs r ON r.id = j.run_id \ |
|
| 150 | - | WHERE r.repo_id = $1 AND j.name = $2 AND j.peak_disk_mib IS NOT NULL ORDER BY j.id DESC LIMIT $3)", |
|
| 150 | + | WHERE r.repo_id = $1 AND j.name = $2 AND j.peak_disk_mib IS NOT NULL ORDER BY j.id DESC LIMIT $3) recent", |
|
| 151 | 151 | ) |
|
| 152 | 152 | .bind(repo_id) |
|
| 153 | 153 | .bind(name) |
|
| … | 992 unchanged lines |