prefer-jsonb
warningjson column type
Why it's unsafe
A json column has no equality or ordering operators, so SELECT DISTINCT, GROUP BY, UNION, and ORDER BY on it fail at query time.
Safe rewrite
Use jsonb instead — it supports those operators and indexing. json only preserves exact input text and duplicate/key order, which is rarely needed.
Example
Try it in the playground →Unsafe
CREATE TABLE events (payload json);Safe
CREATE TABLE events (payload jsonb);