Skip to main content

prefer-bigint-over-int

problem

Using 32 bit integer fields can result in hitting the max int limit.

solution

Use 64 bit integer field instead, like BIGSERIAL or BIGINT.

serial

Instead of:

CREATE TABLE posts (
id serial primary key
)

Use:

CREATE TABLE posts (
id bigserial primary key
)

int

Instead of:

CREATE TABLE posts (
id int primary key
)

Use:

CREATE TABLE posts (
id bigint primary key
)

See "prefer-bigint-over-smallint"for a simliar lint rule against 16 bit integers.