Skip to content

no-select-star

SQL SELECT projections should list explicit result columns instead of wildcards.

Why

Wildcard projections can over-fetch data and silently change result contracts when a source schema evolves.

Fix

List the output columns required by the query consumer. Suppress with a rationale when a bounded intermediate relation intentionally preserves its complete shape.

Examples

Before — flagged Store query selects every column
app/call_store.py
row = cursor.execute(
"SELECT c.* FROM call AS c WHERE c.id = %s",
(call_id,),
).fetchone()
call = Call.model_validate(row)
After — preferred Store query selects named columns
app/call_store.py
row = cursor.execute(
"SELECT c.id, c.status FROM call AS c WHERE c.id = %s",
(call_id,),
).fetchone()
call = Call.model_validate(row)