Common SQL Errors

MySQL Error 1368 ER_VIEW_NONUPD_CHECK: CHECK OPTION on Non-Updatable View – Fix & Prevent

Galaxy Team
August 6, 2025

<p>MySQL raises ER_VIEW_NONUPD_CHECK when you add WITH CHECK OPTION to a view that the server considers non-updatable.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1368 (ER_VIEW_NONUPD_CHECK)?

<p>MySQL Error 1368 ER_VIEW_NONUPD_CHECK appears when WITH CHECK OPTION is declared on a non-updatable view. Remove the clause or make the view updatable-for example, select a single base table without aggregates-to resolve the error.</p>

Error Highlights

Typical Error Message

CHECK OPTION on non-updatable view '%s.%s'

Error Type

DDL Error

Language

MySQL

Symbol

ER_VIEW_NONUPD_CHECK

Error Code

1368

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1368 (ER_VIEW_NONUPD_CHECK)?

MySQL throws ER_VIEW_NONUPD_CHECK with SQLSTATE HY000 when a CREATE VIEW or ALTER VIEW statement includes WITH CHECK OPTION but the view is not updatable. An updatable view must allow INSERT, UPDATE, or DELETE to propagate to its base table. When the optimizer detects that updates cannot be pushed down, it blocks the definition.

Why does the server block non-updatable views with CHECK OPTION?

WITH CHECK OPTION guarantees that any row written through the view satisfies its WHERE clause. If a view cannot accept writes, the guarantee is pointless and potentially misleading. Therefore, MySQL enforces the rule at definition time.

How does this error impact production code?

The statement returns an error and the view is not created or altered, halting deployment scripts. Continuous integration pipelines and application releases can fail until the definition is corrected.

Which MySQL versions raise the error?

The rule exists in MySQL 5.6, 5.7, 8.0, and MariaDB forks. Behavior is consistent across platforms because it is part of the SQL standard.

Common Causes

Non-updatable SELECT list

The view selects derived columns, expressions, or functions instead of direct base table columns, preventing updates.

Aggregations or DISTINCT

GROUP BY, HAVING, DISTINCT, or window functions make the result set non-deterministic for row-level writes, so the view becomes non-updatable.

JOIN, UNION, or subquery usage

Combining multiple tables or UNION clauses breaks the one-to-one mapping required for updatable views.

LIMIT or OFFSET clauses

Row restrictions hide part of the underlying data set, so MySQL blocks updates.

ALGORITHM=MERGE not possible

If MySQL cannot use the MERGE algorithm, it falls back to TEMPTABLE, which is inherently read-only.

Related Errors

MySQL Error 1367 ER_VIEW_CHECK_FAILED

Occurs when an INSERT or UPDATE through a view violates its CHECK OPTION.

MySQL Error 1288 ER_NON_UPDATABLE_TABLE

Raised when trying to modify a result set that is fundamentally read-only, including some views.

MySQL Error 1349 ER_VIEW_SELECT_CLAUSE

Triggered when the SELECT list of a view contains invalid items, such as a subquery.

FAQs

Does removing CHECK OPTION affect read queries?

No - the option only enforces data validation on writes. Select queries behave the same.

Can I keep CHECK OPTION and still use joins?

Not directly. Convert the view to reference a single table or use triggers to enforce constraints.

How do I test if a view is updatable?

Run SELECT * FROM information_schema.views and check the IS_UPDATABLE column. A value of YES confirms updatability.

Is there a performance hit for CHECK OPTION?

Minimal - MySQL only evaluates the view WHERE clause during write operations.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo