1587
MySQLERRORNotableStored RoutinesHIGH confidence

Native function name collision with stored function

Production Risk

Low — the CREATE FUNCTION fails; no function is created.

What this means

A stored function was created with the same name as a native MySQL function, causing a naming collision.

Why it happens
  1. 1Creating a stored function whose name matches a built-in MySQL function name.
How to reproduce
trigger — this will error
trigger — this will error
CREATE FUNCTION NOW() RETURNS DATETIME RETURN '2024-01-01';

expected output

ERROR 1587 (HY000): This function 'now' has the same name as a native function

Fix

Use a unique name for the stored function

Use a unique name for the stored function
CREATE FUNCTION my_custom_now() RETURNS DATETIME RETURN '2024-01-01';

Why this works

Stored function names must not conflict with built-in MySQL function names.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1587 ER_NATIVE_FCT_NAME_COLLISION

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors