no-select-star

Disallow implicit SELECT * queries

Severity: Error

What it does

Requires every db.select() call to explicitly name the columns it returns. Using db.select() without arguments is equivalent to SELECT * and brings back all columns from the table.

Why it matters

Implicit SELECT * can:

  • Return more data than needed, wasting bandwidth and memory.
  • Break your app when columns are added or removed from the schema.
  • Make the query intent unclear to future readers.

How it works

Pulsar inspects every db.select() call in the Drizzle chain. If the first argument to .select() is missing or empty (no object with column projections), the rule fires.

When to disable

Disable this rule if you prefer SELECT * for quick prototyping or if your queries always need all columns and you explicitly want to avoid maintaining a column list.

Examples

Bad
const user = await db.select().from(users);
Good
const user = await db.select({ id: users.id, name: users.name }).from(users);

Last updated on

On this page