Informix Error -292
-292 An implied insert column column-name does not accept NULLs.
This INSERT statement does not supply values for all the columns in the table. At least one of the columns that it omits is constrained to be not null. Because the database server would have to insert a null value for every unmentioned column, it cannot perform this insert. Review the statement against the definition of the table. Possibly the definition of the table has been changed.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-292 means an INSERT statement's explicit column list omitted a column that has a NOT NULL
constraint and no default value — the omitted column would implicitly receive NULL, which
isn't allowed.
- An
INSERTwith an explicit column list omitting aNOT NULLcolumn with no default — the direct cause. - A schema change since the statement was written — an
ALTER TABLE ADD COLUMN ... NOT NULL, or an existing column changed toNOT NULL, breaking a previously-workingINSERTthat never needed to mention that column before. - Confusion about which columns actually require an explicit value versus which have defaults or are nullable.
- Auto-generated
INSERTstatements (from an ORM or code generator) not kept in sync with schema changes that add new required columns.
Solutions / Resolution
- Verify the
INSERTstatement's column list against the table's current schema, per the official guidance — the table structure may have changed since the statement was written. - Add the missing column and a suitable value to the
INSERTstatement. - Alternatively, add a
DEFAULTvalue to the column's definition if appropriate, so future inserts that omit it don't need to specify it explicitly. - For ORMs or generated code, ensure the mapping is regenerated after schema changes that
add
NOT NULLcolumns.
Examples
A schema change breaking a previously-working INSERT
-- Originally:
INSERT INTO orders (order_id, customer_id) VALUES (1001, 42);
-- worked fine when orders only had order_id, customer_id, and
-- nullable columns
-- After: ALTER TABLE orders ADD status VARCHAR(20) NOT NULL;
-- The same statement now fails:
INSERT INTO orders (order_id, customer_id) VALUES (1001, 42);
-- -292: status has no default and wasn't mentioned
Fix — include the new required column:
INSERT INTO orders (order_id, customer_id, status) VALUES (1001, 42, 'pending');
Or, if a sensible default exists, add it to the column definition instead:
ALTER TABLE orders MODIFY (status VARCHAR(20) DEFAULT 'pending' NOT NULL);
Diagnostic Checks
- Compare the
INSERT's column list against the table's current column definitions forNOT NULLcolumns without defaults:SELECT colname FROM syscolumns c, systables t WHERE t.tabid = c.tabid AND t.tabname = 'orders'; - Review recent schema changes (
ALTER TABLE ADD COLUMN NOT NULL) if this appeared unexpectedly on a statement that used to work.
Related Errors / Related Topics
- -269 — "Cannot add column column-name that does not accept nulls." Related through the
same
NOT NULL-column theme, though about adding the column to an existing populated table rather than inserting into it afterward. - -236 — "Number of columns in INSERT does not match number of VALUES." Another common
INSERT-construction error in the same general category.
Check for a recent schema change first if this appears on an INSERT that used to work — a new
NOT NULL column without a default is the most common actual cause.