Oracle 5.0 Reference Manual page 1068

Table of Contents

Advertisement

You can refer to columns in the subject table (the table associated with the trigger) by using the aliases
and NEW.
OLD
OLD.col_name
refers to the column of a new row to be inserted or an existing row after it is updated.
NEW.col_name
MySQL stores the
sql_mode
created, and always executes the trigger with this setting in force, regardless of the current server SQL
mode.
Note
Currently, cascaded foreign key actions do not activate triggers.
The
clause specifies the MySQL account to be used when checking access privileges
DEFINER
at trigger activation time. If a
'user_name'@'host_name'
or
[959]. The default
CURRENT_USER()
statement. This is the same as specifying
TRIGGER
If you specify the
DEFINER
• If you do not have the
specified literally or by using
account.
• If you have the
SUPER
account does not actually exist, a warning is generated.
• Although it is possible to create a trigger with a nonexistent
for such triggers to be activated until the account actually does exist. Otherwise, the behavior with
respect to privilege checking is undefined.
Note: Because MySQL currently requires the
only the second of the preceding rules applies. (MySQL 5.1.6 implements the
requires that privilege for trigger creation, so at that point both rules come into play and
required only for specifying a
From MySQL 5.0.17 on, MySQL takes the
as follows:
• At
CREATE TRIGGER
• At trigger activation time, privileges are checked against the
these privileges:
• The
[578]
privilege.
SUPER
• The
[578]
SELECT
or
OLD.col_name
• The
[578]
UPDATE
NEW.col_name = value
• Whatever other privileges normally are required for the statements executed by the trigger.
Before MySQL 5.0.17,
• At
CREATE TRIGGER
• At trigger activation time, privileges are checked against the user whose actions cause the trigger
to be activated. This user must have whatever privileges normally are required for the statements
executed by the trigger.
CREATE TRIGGER
refers to a column of an existing row before it is updated or deleted.
[495]
system variable setting that is in effect at the time a trigger is
value is given, it should be a MySQL account specified as
user
(the same format used in the
DEFINER
clause, these rules determine the legal
[578]
privilege, the only legal
SUPER
CURRENT_USER
[578]
privilege, you can specify any syntactically legal account name. If the
value other than your own account.)
DEFINER
DEFINER
time, the user who issues the statement must have the
privilege for the subject table if references to table columns occur using
in the trigger definition.
NEW.col_name
privilege for the subject table if table columns are targets of
assignments in the trigger definition.
is not available and MySQL checks trigger privileges like this:
DEFINER
time, the user who issues the statement must have the
1048
Syntax
GRANT
value is the user who executes the
DEFINER = CURRENT_USER
DEFINER
value is your own account, either
user
[959]. You cannot set the definer to some other
DEFINER
[578]
privilege for the use of
SUPER
user into account when checking trigger privileges
DEFINER
statement),
CURRENT_USER
CREATE
explicitly.
user values:
account, it is not a good idea
CREATE
TRIGGER,
privilege and
TRIGGER
SUPER
[578]
SUPER
user. This user must have
SET
[578]
SUPER
[959],
[578]
is
privilege.
privilege.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents