Informix Error -537
-537 Constraint column column-name not found in table.
The column that is specified in a constraint definition does not exist.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-537 fires when a constraint definition (a PRIMARY KEY, UNIQUE, FOREIGN KEY, or CHECK
naming specific columns) references a column name that doesn't exist on the table.
- A misspelled column name in the constraint's column list — the most common, direct cause.
- A constraint written against a column that was renamed or dropped in an earlier schema change, without updating the constraint DDL to match.
- Copy-pasted constraint DDL from a similar but differently-shaped table, carrying over a column name that doesn't exist on this particular table.
Solutions / Resolution
- Review the column name in the constraint definition against the table's actual columns, correcting any misspelling.
- Confirm the table's current column list before writing the constraint:
SELECT colname FROM syscolumns WHERE tabid = (SELECT tabid FROM systables WHERE tabname = 'orders') ORDER BY colno; - Update the constraint to reference the column's current name, if it was renamed since the constraint DDL was originally written.
Examples
A misspelled column name
ALTER TABLE orders ADD CONSTRAINT
CHECK (order_staus IN ('pending','shipped')) CONSTRAINT ck_orders_status;
-- -537: 'order_staus' -- the actual column is 'status'
Corrected
ALTER TABLE orders ADD CONSTRAINT
CHECK (status IN ('pending','shipped')) CONSTRAINT ck_orders_status;
Diagnostic Checks
- Query
syscolumnsfor the table's actual column names and compare them character-by- character against the constraint's column references.
Related Errors / Related Topics
- -536 — "Number of columns in child constraint does not match number of cols in parent constraint." A related but distinct constraint-definition error: a count mismatch between two existing column lists, rather than a column name that doesn't exist at all.
A straightforward name mismatch — query syscolumns for the table's real column names before
retrying.