## TL;DR
relation "users" does not exist means Postgres has no such table - your Drizzle schema was never applied to this database. Run the migration (`drizzle-kit migrate`) or push the schema (`drizzle-kit push`), and make sure you are connected to the right database.

## The error
```text
PostgresError: relation "users" does not exist
```

## Fix it
1. **Confirm you are on the right database.** Print the connection string's database name (redacted) and compare with where you think the tables are. Wrong-database is the top cause.
   - Expected: the connected database is the one you migrated.
2. **Apply the schema.** For drizzle-kit:
   ```bash
   npx drizzle-kit push
   ```
   or with migrations:
   ```bash
   npx drizzle-kit migrate
   ```
   - Expected: tables created, the query succeeds.
3. **Check the schema name.** If your tables live in a non-public schema, Drizzle needs `pgSchema("myschema", ...)` and the database role needs USAGE on it. Unqualified `users` resolves to the search_path, usually public.
   - Expected: qualified or search_path-correct table references.
4. **Check table-name casing.** Drizzle lowercases unquoted names; a table created as `"Users"` (quoted) is a different relation from `users`. Keep names lowercase or quote consistently.
   - Expected: the relation name matches exactly.

## When to use
- relation does not exist on a table Drizzle defines.
- Fresh database, new environment, or after a database reset.

## When NOT to use
- column does not exist - the table is there, a column is missing (schema drift).
- Auth/connection errors - the query never reached Postgres.

## Compatibility
- Drizzle ORM with drizzle-kit, PostgreSQL.

## Root cause
Drizzle builds SQL from your TypeScript schema but does not create tables at runtime. If migrations/push never ran against the connected database, Postgres reports the missing relation.

## Edge cases
- `drizzle-kit push` is for prototyping; use versioned `migrate` in production.
- Multiple schemas: `pgTable` without `pgSchema` always targets the search_path default.
