Data Type Best Practices

pgfence catches common type choices that will cause problems down the line.

#PatternRiskSuggestion
20ADD COLUMN ... jsonLOWUse jsonb: json has no equality operator and is generally slower
21ADD COLUMN ... serialLOWUse GENERATED BY DEFAULT AS IDENTITY: SERIAL creates implicit sequences with ownership quirks and permission issues
22integer / int columnsLOWUse bigint: changing to bigint later requires an ACCESS EXCLUSIVE rewrite
23varchar(N) columnsLOWUse text: increasing varchar length requires ACCESS EXCLUSIVE on older Postgres versions
24timestamp without time zoneLOWUse timestamptz to avoid timezone-related bugs
25char(N) / character(N) columnsLOWUse text: char(n) pads values with spaces, wastes storage, and changing the length later requires ACCESS EXCLUSIVE + table rewrite
26serial / bigserial / smallserial columnsLOWUse GENERATED BY DEFAULT AS IDENTITY: IDENTITY columns have cleaner ownership semantics, avoid implicit sequence permission issues, and are the SQL standard