PostgreSQL in Production: Errors, Auth & Query Patterns
These are the exact errors that show up in psql or your app logs, with the fix and why it happens. Most apply whether your Postgres instance is bare-metal, Supabase, or any other managed host.
Connecting & authenticating
4 itemsFix: password authentication failed for user "postgres"
Postgres password authentication failed = wrong password, md5 method mismatch, or the role has no password set.
Fix: Peer Authentication Failed for User "postgres"
Peer auth failed for user postgres = OS user and PG role mismatch. Fix: sudo -u postgres psql, or switch pg_hba.conf to scram-sha-256 and set a password.
How to Change a PostgreSQL User Password (Supabase)
Change a PostgreSQL password with ALTER ROLE or psql \password. Reset the postgres role in Supabase from the Dashboard, plus the connection gotchas.
Fix: psql: command not found (Install PostgreSQL Client)
psql command not found = PostgreSQL client not installed, or not on PATH. Install via brew/apt/choco/scoop, or add the bin directory to PATH.
Querying & schema inspection
5 itemsPostgreSQL DESCRIBE TABLE: The psql \d Equivalent
There is no DESCRIBE TABLE in PostgreSQL — run \d table_name in psql, or query information_schema.columns from any SQL client, including Supabase.
PostgreSQL SHOW TABLES / DESCRIBE TABLE (psql + Supabase)
PostgreSQL has no SHOW TABLES. Use \dt or \d table_name in psql; use information_schema.tables in Supabase, Drizzle, or any SQL client.
How to get COUNT(*) in Supabase
Get COUNT(*) in Supabase with { count: 'exact', head: true } — the total without downloading rows. Plus planned and estimated counts for big tables.
Select the First Row per Group in Supabase Postgres
Need the latest row per user or top score per team? GROUP BY can't return the whole row — here's the PostgreSQL DISTINCT ON pattern.
Supabase Enums: ALTER TYPE ADD VALUE in Migrations
Create enums with CREATE TYPE, extend with ALTER TYPE ... ADD VALUE — run it with transactions disabled in Supabase migrations to avoid "unsafe use".
Other hubs
Next.js + Supabase: The Complete Resource Hub
Everything you need to build production-ready full-stack apps with Next.js 15 and Supabase — authentication, RLS, deployments, performance, and architecture decisions.
Supabase Debugging & Troubleshooting Hub
Field-tested fixes for the Supabase errors that actually waste your time: RLS silent failures, session persistence, slow queries, realtime gotchas, and auth redirects.
n8n Automation: Real Workflows from Real Projects
Practical n8n automation guides built from actual client work — CRM lead capture, client reporting, Zapier migration, silent failure debugging, and self-hosted AI with Ollama.
TypeScript Type Errors: Fixes for Next.js Developers
The TypeScript compiler errors (TS2322, TS2305, TS7016, TS2564 and friends) you actually hit building Next.js apps, with the fix and the type-system reasoning behind it.