Common SQL Errors

MySQL Error 1697: ER_VALUES_IS_NOT_INT_TYPE_ERROR - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>MySQL error 1697 arises when a PARTITION VALUES clause contains a non-integer value although the partitioning column is defined as INT.</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 1697?

<p>MySQL Error 1697: ER_VALUES_IS_NOT_INT_TYPE_ERROR appears when a VALUES list for a RANGE or LIST partition contains something other than an INT. Convert the literal or column to INT, recreate the partition definition, and the statement will succeed.</p>

Error Highlights

Typical Error Message

VALUES value for partition '%s' must have type INT

Error Type

Partitioning Error

Language

MySQL

Symbol

ER_VALUES_IS_NOT_INT_TYPE_ERROR

Error Code

1697

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 1697 ER_VALUES_IS_NOT_INT_TYPE_ERROR?

Error 1697 is triggered during CREATE TABLE or ALTER TABLE when MySQL validates partition definitions. The VALUES list for each partition must match the data type of the partitioned column. If the column is INT but the VALUES entry is not an integer, MySQL raises ER_VALUES_IS_NOT_INT_TYPE_ERROR with the message "VALUES value for partition '%s' must have type INT".

Why does this type mismatch occur in partition definitions?

MySQL enforces strict type checking for RANGE and LIST partitions to guarantee deterministic partition pruning. A character literal, decimal constant, or function call in a VALUES list cannot be implicitly cast to INT in this context, so the parser aborts with error 1697.

How do I fix ER_VALUES_IS_NOT_INT_TYPE_ERROR?

Confirm the partitioning key data type, rewrite each VALUES clause to use integer literals, and re-execute the DDL. When the source data is VARCHAR or DECIMAL, cast or convert it before inserting or choose a compatible INT column for partitioning.

When is this error most likely to appear?

The error surfaces after schema migrations, automated code generation, or manual edits that introduce string dates (e.g. '20240101') or numeric values with quotes into VALUES lists. CI pipelines that run DDL scripts also frequently surface the problem.

Common Causes

Quoted numeric literals

Writing VALUES ('100', '200') instead of 100, 200 makes MySQL treat them as strings, causing the mismatch.

Decimal constants

Including 100.0 or 50.5 in a VALUES list for an INT column triggers the error because decimals are not integers.

Function calls

Using UNIX_TIMESTAMP() or other functions inside VALUES prevents MySQL from validating an INT at parse time.

Related Errors

MySQL Error 1493: ER_PARTITION_FUNCTION_NOT_ALLOWED

Occurs when the partition function uses an unsupported expression such as RAND().

MySQL Error 1503: ER_PARTITION_COLUMN_LIST_ERROR

Raised when the column list in a partition definition does not match the primary key.

MySQL Error 1731: ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD

Appears when you attempt to partition by a column type that MySQL does not allow, such as TEXT or BLOB.

FAQs

Can I disable strict type checking for partition VALUES?

No. MySQL enforces this rule at parse time to preserve partition integrity.

Will casting inside VALUES work?

No. MySQL requires literal integers. CAST() and functions are evaluated at runtime, not at DDL parsing.

Does the error depend on MySQL version?

The rule exists in all GA versions that support partitioning. From 5.1 to 8.1 the behavior is identical.

How does Galaxy help avoid this mistake?

Galaxy's type-aware linting flags non-integer VALUES in real time and the AI copilot auto-corrects them before you run the statement.

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