---
title: Fix data view dropping seasonlogs columns from SELECT and WHERE
type: task
status: draft
description: >-
  Bare-string seasonlogs column references (no params object) are silently dropped from generated
  SQL in both SELECT and WHERE positions, producing missing columns and missing filters with no
  warning. Found via debug-data-view validation of two views from a 2024 bug note.
base_uri: user:task/league/fix-data-view-dropping-seasonlogs-columns-silently.md
created_at: '2026-04-25T14:51:26.714Z'
entity_id: 7a7e0fe7-8a47-48d6-b209-e743872550d2
observations:
  - ████████████████████████████████████████████████
owner_identity_uri: █████████████████████████
priority: Low
public_read: true
tags:
  - user:tag/league-xo-football.md
updated_at: '2026-08-05T19:18:37.852Z'
visibility_analyzed_at: '2026-11-05T23:49:20.611Z'
---

# Fix data view dropping seasonlogs columns from SELECT and WHERE

Two related bugs in the data view query generator -- both surface when `player_fantasy_games_played_from_seasonlogs` (and likely other seasonlogs rate-type columns) is referenced as a bare string column ID rather than as an object with an explicit `params` block.

## Symptom 1: Column dropped from SELECT

View: https://xo.football/u/af73be33da1891221e6143efd38f9838

The URL lists `player_fantasy_games_played_from_seasonlogs` as a bare string in the `columns` array. The generated SQL silently drops it from the SELECT, so no output column is produced.

## Symptom 2: WHERE clause dropped

View: https://xo.football/u/f821c9d8876da4e343592c3eeb269089

The URL specifies a WHERE filter `player_fantasy_games_played_from_seasonlogs >= 8` (intended as a games-played minimum). The generated SQL omits the condition entirely -- no WHERE/HAVING on `rate_type_total_count` -- so QBs with very few games still appear.

## Likely root cause

The data view fields-index entry for seasonlogs rate-type columns probably requires an explicit `params` object to bind the rate-type CTE. When the column appears bare (no params), the generator's "drop unbindable references" path removes it silently from both SELECT and WHERE rather than falling back to defaults or surfacing an error.

## Acceptance

- View `af73be33...` renders the games-played column with values.
- View `f821c9d8...` applies the `>= 8` minimum games threshold.
- Generator emits a warning (or hard error) when a referenced column is dropped, instead of silently omitting it from the output.
- Add a regression test for each: bare-string column in SELECT and bare-string column in WHERE.

## Source

Captured in Apple Notes "missing fantasy points season projections..." (mod 2024-07-27). Validated 2026-04-25 via `workflow/debug-data-view.md`. Of the three URLs in the original note:

- `7ccc759ff7d0bb88c83af3fe144b710c` -- "missing fantasy points season projections": **fixed** (439/500 rows have projections; nulls are absent upstream data, not a code bug).
- `af73be33da1891221e6143efd38f9838` -- "empty fantasy points games played": **still broken** (Symptom 1 above).
- `f821c9d8876da4e343592c3eeb269089` -- "default year for seasonlogs mismatch": **still broken** (Symptom 2 above).
