fix: use explicit e.state in bulk experiment delete query #8491
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix an error where bulk delete can fail when using a filter with a message like:
[bun] 13:29:26.577 SELECT 632µs SELECT "e"."id", CASE e.state::text WHEN 'STARTING' THEN 15 WHEN 'DELETE_FAILED' THEN 11 WHEN 'QUEUED' THEN 13 WHEN 'ACTIVE' THEN 1 WHEN 'PAUSED' THEN 2 WHEN 'STOPPING_ERROR' THEN 5 WHEN 'COMPLETED' THEN 6 WHEN 'ERROR' THEN 8 WHEN 'DELETING' THEN 10 WHEN 'RUNNING' THEN 16 WHEN 'UNSPECIFIED' THEN 0 WHEN 'STOPPING_COMPLETED' THEN 3 WHEN 'STOPPING_CANCELED' THEN 4 WHEN 'CANCELED' THEN 7 WHEN 'DELETED' THEN 9 WHEN 'PULLING' THEN 14 WHEN 'STOPPING_KILLED' THEN 12 END AS state, COUNT(model_versions.id) AS versions FROM experiments as e JOIN projects p ON e.project_id = p.id LEFT JOIN checkpoints_view c ON c.experiment_id = e.id LEFT JOIN model_versions ON model_versions.checkpoint_uuid = c.uuid WHERE (project_id = 1) AND (state IN ('CANCELED', 'COMPLETED', 'ERROR')) GROUP BY "e"."id" *pgconn.PgError: ERROR: column reference "state" is ambiguous (SQLSTATE 42702)
Test Plan
Adds automated test.
Commentary (optional)
Checklist
docs/release-notes/
.See Release Note for details.
Ticket