<p>MySQL throws ER_ONLY_INTEGERS_ALLOWED when a statement requires a whole number and receives a non-integer value instead.</p>
<p>MySQL Error 1578 ER_ONLY_INTEGERS_ALLOWED occurs when you pass a non-integer where the SQL grammar expects a whole number, such as LIMIT, AUTO_INCREMENT, or partition definitions. Convert or cast the value to an integer and execute the statement again to fix the error.</p>
Only integers allowed as number here
The error message "Only integers allowed as number here" signals that MySQL expected a whole number literal but encountered a decimal, string, or expression that resolves to a non-integer.
Because certain clauses require literal integers for predictable execution plans, the server rejects any value that is not a strict integer, raising SQLSTATE HY000 with error code 1578.
The error surfaces in clauses such as LIMIT, OFFSET, AUTO_INCREMENT, partition VALUE definitions, and ALTER TABLE operations that take integer parameters.
It can also appear inside stored routines, events, or generated columns if the supplied argument is not an integer constant.
Failing statements halt deployments, break automation scripts, and block data pipelines. Addressing the root cause prevents downtime and preserves data integrity.
Quick resolution also reduces noise in monitoring systems and avoids cascading failures in dependent services.
Supplying a decimal or string to the LIMIT clause, for example LIMIT 10.5 or LIMIT '20', triggers the error.
Using ALTER TABLE mytable AUTO_INCREMENT = 3.7 passes a non-integer and fails.
VALUES LESS THAN (100.5) or subpartition definitions with floats violate the integer requirement.
Binding a VARCHAR instead of an INT to an integer placeholder causes the server to reject the statement.
Expressions like LIMIT ROUND(10.2) or AUTO_INCREMENT = CEIL(9.8) are evaluated at parse time and may fail if not integers.
Occurs when function arguments are of incorrect type or count.
Raised for general SQL syntax mistakes, including misplaced commas or keywords.
Triggered when LIMIT values are negative or out of range.
Indicates duplicate table aliases within a query, unrelated but frequently seen during complex refactors.
Yes, but the expression must evaluate to an integer at parse time. Use FLOOR(), CEIL(), or CAST(... AS UNSIGNED).
Strict or non-strict SQL modes do not override the integer requirement for clauses that mandate literal integers.
Bind parameters with integer data types or cast within the query using CAST(? AS UNSIGNED).
Galaxy surfaces an inline warning and offers one-click correction to the nearest integer, streamlining the fix.