1444
MySQLERRORNotablePrepared StatementsHIGH confidence

Prepared statement contains a stored routine that refers back to itself

Production Risk

Low — the prepared statement will fail at execute time.

What this means

ER_PS_NO_RECURSION (1444, SQLSTATE HY000) is raised when a prepared statement calls a stored routine that in turn references the same prepared statement, creating illegal recursion.

Why it happens
  1. 1A stored procedure or function called from a prepared statement re-executes the same prepared statement
How to reproduce
trigger — this will error
trigger — this will error
PREPARE stmt FROM 'CALL my_proc()';
-- my_proc internally calls EXECUTE stmt; -- recursion!
EXECUTE stmt;

expected output

ERROR 1444 (HY000): The prepared statement contains a stored routine call that refers back to the prepared statement itself.

Fix

Eliminate the recursive reference

Eliminate the recursive reference
-- Restructure so the stored procedure does not reference the prepared statement:
DELIMITER //
CREATE PROCEDURE my_proc()
BEGIN
  SELECT * FROM my_table;  -- No reference back to the prepared statement
END //
DELIMITER ;

Why this works

Removing the circular reference between the prepared statement and the stored routine resolves the error.

Sources
Official documentation ↗

MySQL 8.0 — 1444 ER_PS_NO_RECURSION

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

← All MySQL errors