MySQL Internals Manual  /  ...  /  Stored Procedure and Stored Function Storage

16.2.1 Stored Procedure and Stored Function Storage

The table mysql.proc contains one record per Stored Procedure or Stored Function. Note that this table design is a mix of relational and non relational (blob) content:

  • Attributes that are part of the interface of a stored procedure or function (like its name, return type, etc), or that are global to the object (implementation language, deterministic properties, security properties, sql mode, etc) are stored with a dedicated column in the mysql.proc table.

  • The body of a stored procedure or function, which consists of the original code expressed in SQL, including user comments if any, is stored as-is preserving the original indentation in blob column 'body'.

This design choice allows the various attributes to be representedin a format that is easy to work with (relational model), while allowing a lot of flexibility for the content of the body.

A minor exception to this is the storage of the parameters of a stored procedure or function (which are part of its interface) inside the blob column param_list (instead of using a child proc_param table).

Table mysql.procs_priv describes privileges granted for a given Stored Procedure or Stored Function in mysql.proc.

The code used to encapsulate database access is:

  • db_create_routine()

  • db_load_routine()

  • db_drop_routine()

  • mysql_routine_grant()

  • grant_load()

  • grant_reload()

User Comments
Sign Up Login You must be logged in to post a comment.