Informix Error -26455: Cannot specify both a NOT NULL constraint and a NULL constraint for the same column.
Cause and resolution
Cannot specify both a NOT NULL constraint and a NULL constraint for the same column.
The database server issues this error when the CREATE TABLE or ALTER TABLE statement attempts to define a table schema that includes a column definition with contradictory specifications regarding NULL values. - The NOT NULL constraint prevents the database server from storing NULL values in this column. - The NULL constraint allows the database server store NULL values in this column. To avoid this error, revise the column definition so that it does not include both NOT NULL and NULL specifications on the same column. - If you want to prohibit NULL values in this column, you must drop the NULL specification in the column definition. - If you want to allow NULL values in this column, you must drop the NOT NULL specification in the column definition.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26455 fires when a column definition specifies both NOT NULL and NULL — per the
official guidance.
- A column defined with both
NOT NULL(which prevents nulls) andNULL(which allows them), per the official guidance — the direct, only cause; contradictory.
Solutions / Resolution
- To prohibit nulls, drop the
NULLspecification, per the official guidance, or - To allow nulls, drop the
NOT NULLspecification, per the official guidance.
Examples
A contradictory column definition
CREATE TABLE orders (notes VARCHAR(80) NOT NULL NULL);
-- -26455: NOT NULL and NULL are contradictory
Corrected
CREATE TABLE orders (notes VARCHAR(80) NOT NULL);
Diagnostic Checks
- Check the column definition for both
NOT NULLandNULL, and remove one.
Related Errors / Related Topics
- -26454 — "Cannot specify both a PRIMARY KEY constraint and a NULL constraint for
the same column." The same class of contradictory-nullability error, for
PRIMARY KEY/NULLrather thanNOT NULL/NULL.
A column definition specified both NOT NULL and NULL — remove one.