Common SQL Errors

MySQL Error 1585 ER_NATIVE_FCT_NAME_COLLISION: How to Fix Function Name Conflicts

Galaxy Team
August 7, 2025

<p>MySQL raises this error when you try to create a user-defined function that has the same name as a built-in MySQL function.</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 ER_NATIVE_FCT_NAME_COLLISION?

<p>MySQL Error 1585: ER_NATIVE_FCT_NAME_COLLISION occurs when a user-defined function shares a name with a native MySQL function. Rename the custom function or drop it before redefining to resolve the conflict.</p>

Error Highlights

Typical Error Message

This function '%s' has the same name as a native function

Error Type

Name Conflict Error

Language

MySQL

Symbol

ER_NATIVE_FCT_NAME_COLLISION

Error Code

1585

SQL State

HY000

Explanation

Table of Contents

What does MySQL Error 1585 ER_NATIVE_FCT_NAME_COLLISION mean?

The server blocks creation of a user-defined function when its name duplicates a built-in function such as COUNT, SUM, or NOW. MySQL protects native functions to avoid ambiguity in query parsing and execution.

What causes this error?

The CREATE FUNCTION statement collides with an existing native or previously defined function. Collisions can also arise when migrating code from another database that allows overriding built-ins.

How can I fix ER_NATIVE_FCT_NAME_COLLISION?

Choose a unique, descriptive name like user_count or app_sum. Alternatively, drop or rename the conflicting user function, then recreate it with a non-reserved identifier.

Best practices to prevent future name collisions

Adopt a consistent naming convention that prefixes user functions, maintain an object inventory, and validate scripts in a staging environment or in Galaxy's linting panel before deployment.

Common Causes

Using a reserved MySQL function name

Attempting CREATE FUNCTION count() or sum() triggers the collision.

Copying code from other RDBMS systems

Some platforms allow overriding built-ins, so migrations may fail in MySQL.

Accidental duplicate deployment

Automated scripts may redeploy an existing function with the same name as a native one.

Related Errors

MySQL Error 1304: ER_SP_ALREADY_EXISTS

Raised when a stored procedure with the same name already exists in the database.

MySQL Error 1307: ER_SP_DOES_NOT_EXIST

Occurs when you reference a procedure or function that has not been created.

MySQL Error 1064: ER_PARSE_ERROR

A generic syntax error that can appear if function definitions are malformed.

FAQs

Can I force MySQL to override a native function?

No. MySQL does not allow overriding built-in functions for stability and security reasons.

Is quoting the function name with backticks a valid workaround?

Quoting does not bypass the collision check. You must use a unique name.

Does this error occur in stored procedures too?

Only when defining a function object. Calling a built-in from a procedure is safe.

How does Galaxy help avoid this error?

Galaxy's editor flags reserved names and suggests alternative function names before execution.

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