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
row = cursor.execute( "SELECT c.* FROM call AS c WHERE c.id = %s", (call_id,),).fetchone()call = Call.model_validate(row)row = cursor.execute( "SELECT c.id, c.status FROM call AS c WHERE c.id = %s", (call_id,),).fetchone()call = Call.model_validate(row)from psycopg import Connection
def literal_rows(): with Connection.connect() as connection: return connection.execute( 'SELECT * FROM (VALUES (1, 2)) AS "authored"("a", "b")' ).fetchall()from psycopg import Connection
def literal_rows(): with Connection.connect() as connection: return connection.execute( 'SELECT "authored"."a", "authored"."b" FROM (VALUES (1, 2)) AS "authored"("a", "b")' ).fetchall()Autofix output
from psycopg import Connection
def literal_rows(): with Connection.connect() as connection: return connection.execute( 'SELECT "authored"."a", "authored"."b" FROM (VALUES (1, 2)) AS "authored"("a", "b")' ).fetchall()query = "SELECT EXISTS((SELECT * FROM jobs)), * FROM runs"query = 'SELECT "units" * "price" AS total FROM entries'