Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

Tables without a primary key: what actually goes wrong

A table without a primary key works. It takes INSERTs, answers SELECTs, passes the test. The problems arrive later, always in a group:

"But it's a log/staging table"

The legitimate case exists: bulk-load staging, an append-only table nobody updates. Even there, an id BIGINT GENERATED ALWAYS AS IDENTITY costs 8 bytes per row and gives you back addressability, stable keyset pagination and the option to deduplicate. The cost of adding it later, with the table huge and production live, is much higher than being born with it.

CREATE TABLE events (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    payload JSONB NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

A natural PK (national id, email, external code) deserves suspicion: a value that comes from outside changes, and changing a PK drags FKs, indexes and caches along. A technical key (identity/UUID) plus a UNIQUE on the natural key gives the same effect without the coupling.

A table without a PK is one of the errors Schemint marks as an error (not a warning) when it analyzes your DDL, before generating the Entity and migration.