Informix Error -974: Cannot drop not null constraint on the serial column.
Cause and resolution
Cannot drop not null constraint on the serial column.
The user issued a statement to drop a NOT NULL constraint on a column that has a SERIAL or SERIAL8 or BIGSERIAL data type. Such constraints can be disabled, but they cannot be dropped before the column is dropped.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-974 is a well-defined restriction on SERIAL, SERIAL8, and BIGSERIAL columns: their
implicit NOT NULL constraint can be disabled, but it can't be dropped outright while the column
itself still exists, per the official guidance.
- A statement attempting to drop the
NOT NULLconstraint on aSERIAL/SERIAL8/BIGSERIALcolumn, per the official guidance — the direct cause. - Not realizing serial-type columns treat
NOT NULLdifferently from ordinary columns — per the official guidance, the constraint can only be disabled, never dropped, until the column itself is dropped.
Solutions / Resolution
- Disable the constraint instead of dropping it, per the official guidance, if the goal is to stop enforcing it while keeping the column.
- Drop the column itself if the
NOT NULLconstraint genuinely needs to go away entirely — per the official guidance, dropping the constraint alone isn't supported for these types.
Examples
The blocked drop
CREATE TABLE orders (order_id SERIAL, ...);
ALTER TABLE orders MODIFY (order_id SERIAL DROP NOT NULL);
-- -974: Cannot drop not null constraint on the serial column.
Disabling instead
ALTER TABLE orders MODIFY CONSTRAINT (...) DISABLED;
-- keeps the column and constraint definition, stops enforcement
Diagnostic Checks
- Confirm the column's declared type is
SERIAL,SERIAL8, orBIGSERIAL— this restriction is specific to those types, not ordinaryNOT NULLcolumns. - Decide whether disabling (keep the column) or dropping the column (remove it entirely) actually matches the intended schema change before proceeding.
Related Errors / Related Topics
- -975 — "Invalid object and object mode combination." A related family of restrictions on which mode/operation combinations are valid for a given object type.
Serial-type NOT NULL constraints can be disabled but not dropped independently — drop the
column itself if the constraint truly needs to go away.