How to Fix MySQL Error 1348 (ER_NONUPDATEABLE_COLUMN)
You get mysql error 1348 when a query tries to change a read-only column. To fix it, write to the base table columns instead of calculated fields. Database teams often see this failure when an app updates a database view. MySQL returns symbol ER_NONUPDATEABLE_COLUMN with SQLSTATE HY000 and stops the write right away. Knowing why the database blocks the change helps you fix the query fast. Why mysql error 1348 happens in your database MySQL lets you build virtual tables called views from one
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mysql error 1348 when a query tries to change a read-only column. To fix it, write to the base table columns instead of calculated fields.
Database teams often see this failure when an app updates a database view. MySQL returns symbol ER_NONUPDATEABLE_COLUMN with SQLSTATE HY000 and stops the write right away. Knowing why the database blocks the change helps you fix the query fast.
Why mysql error 1348 happens in your database
MySQL lets you build virtual tables called views from one or more base tables. Some views let you change data, while others only let you read data. When a column in a view comes from a math formula, it has no real storage. The database engine cannot trace that value back to a single base column.
If a query tries to change that calculated column, MySQL throws code 1348. The engine reports that the specific column is not updatable. This also happens when a view uses grouped rows, distinct filters, or subqueries in the column list. Even if the rest of the view allows writes, that one derived column blocks updates.
Modern table designs also use generated columns inside standard base tables. The database calculates these columns on the fly or stores them from an expression. If a user or app sends a write value directly to a generated column, the engine blocks it. You must update the source columns that feed the formula instead.
How to find the bad column in production
Start by reading the full error message in your app logs. MySQL puts the exact column name inside the error text. Once you have the column name, check the table or view structure in your schema.
Check whether the target object is a base table or a view. If it is a view, inspect the query that builds that view. Look for string functions, math operations, or constant values mapped to that column name. Any column built from a function or literal value will reject direct updates.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If the target is a base table, check the column definition for a generation expression. Developers often add virtual or stored columns to speed up read queries. When an app team writes an insert or update query, they might include all column by mistake. Removing the generated column from the write statement solves the problem right away.
How to fix the query safely in production
The safest fix is to update the underlying base table directly. Point your write query at the real table and change only the source columns. When you update the base columns, the view or generated column updates its own value.
Sometimes an app must write through a view to keep table rules simple. In that case, rewrite the update query to skip the read-only column. Only include view columns that map one-to-one with a single base table column. Do not grant broad database roles or turn off strict checks to work around this rule.
Test your updated query in a staging database before you run it in production. During testing, data masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs in results. Keep write permissions tight so engineers only change the specific columns required for the fix.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
What does ER_NONUPDATEABLE_COLUMN mean in MySQL?
It means your query tried to insert or update a column that cannot accept direct writes. This usually happens with calculated view columns or generated table columns.
Can I update a MySQL view that has calculated columns?
Yes, if the view itself is updatable, you can still change the normal columns. You just have to leave the calculated columns out of your update statement.
How do I change the value of a generated column?
You cannot write directly to a generated column in MySQL. Instead, update the regular base columns that the generated column uses in its formula.
Related guides
In this post