# MP015: no-add-column-serial **Severity**: Warning | **Auto-fixable**: No | **Tier**: Free ## What It Detects ADD COLUMN with SERIAL/BIGSERIAL creates implicit sequence and may rewrite table. ## Why It's Dangerous SERIAL/BIGSERIAL creates an implicit sequence and DEFAULT, which on PG versions before 11 causes a full table rewrite. Use GENERATED ALWAYS AS IDENTITY or manually create the sequence to avoid the rewrite. ## Bad Example ```sql ALTER TABLE orders ADD COLUMN order_num SERIAL; ``` ## Good Example ```sql -- PG 10+: Use GENERATED ALWAYS AS IDENTITY instead of SERIAL: ALTER TABLE orders ADD COLUMN order_num integer GENERATED ALWAYS AS IDENTITY; ``` ## Auto-fix This rule is not auto-fixable. Manual intervention required. ## Configuration ```yaml rules: MP015: false # disable MP015: severity: critical # change severity ``` ## Related Rules - [MP039](./MP039.md) prefer-identity-over-serial -- SERIAL should be replaced by IDENTITY - [MP003](./MP003.md) volatile-default-table-rewrite -- volatile defaults and table rewrites - [MP038](./MP038.md) prefer-bigint-over-int -- use BIGINT for key columns