Informix Error -234: Cannot insert into virtual column column-name.
Cause and resolution
Cannot insert into virtual column column-name.
This INSERT statement is directed to a view, not to a real table, and one of the columns that is defined in the view is actually the value of an expression. Insertions and updates are not allowed on views that have such columns. Apply the INSERT to the real table on which the view is based.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-234 means an INSERT was directed at a view where one of the columns is actually the value of
an expression, not a direct passthrough of a base-table column — a "virtual" column the engine
has no way to translate an inserted value back through to the underlying table.
- A view containing a computed column (a calculated total, a concatenated name, a formatted date) being inserted into directly, rather than through its underlying base table.
- A view designed for read-only reporting or convenience — with calculated columns built in — being mistakenly treated as directly writable by application code.
- ORMs or generic data-access layers treating all views uniformly as writable tables without checking whether they contain computed columns.
- A view that used to be a simple passthrough, later modified to include a computed column,
breaking previously-working
INSERTcode that targeted it.
Solutions / Resolution
- Apply the
INSERTto the real underlying table instead of the view, per the official guidance. - For application code or ORMs, avoid treating views with computed columns as directly writable — identify the actual base table(s) and insert there instead.
- If a view was modified to add a computed column and broke previously-working insert code, either revert to a simple passthrough view or redirect the insert logic to the base table.
- If genuinely necessary to support inserts against a view with computed columns, consider
whether an
INSTEAD OFtrigger mechanism (if available for the version in use) can translate incoming values appropriately — otherwise, the base table remains the only direct path.
Examples
The disallowed insert
CREATE VIEW order_summary AS
SELECT order_id, customer_id, quantity * unit_price AS total
FROM order_items;
INSERT INTO order_summary (order_id, customer_id, total)
VALUES (1001, 42, 99.99);
-- -234: "total" is a computed expression, not a real column
Fix — insert into the actual base table:
INSERT INTO order_items (order_id, customer_id, quantity, unit_price)
VALUES (1001, 42, 3, 33.33);
A view that changed underneath existing insert code
-- Originally a simple passthrough:
CREATE VIEW active_orders AS SELECT * FROM orders WHERE status = 'active';
-- Later redefined to add a computed column:
CREATE VIEW active_orders AS
SELECT *, quantity * unit_price AS line_total FROM orders WHERE status = 'active';
-- Code that used to insert through this view now fails
INSERT INTO active_orders (order_id, quantity, unit_price) VALUES (...);
-- -234, because line_total is now part of the view definition
Diagnostic Checks
- Review the view's definition for which columns are computed expressions versus direct passthroughs of base-table columns.
- Identify the underlying base table(s) to redirect the
INSERTthere instead.
Related Errors / Related Topics
- -205 — "The statement failed because you cannot use ROWID for views with union,
intersect, minus, aggregates, group by, multiple tables, or derived tables." Another
views-related restriction — some view constructs limit what you can do with
ROWID, others (like this one) limit what you can write. - -227 — "DDL operations on ROWID prohibited." Part of the same general family of restrictions on what can and can't be done against particular kinds of columns.
Apply the insert to the actual base table — a view containing a computed column was never meant to accept direct writes to that column.