Mysql-about the problem that Mysql cannot be inserted after setting a trigger

Source: Internet
Author: User
I have set a trigger in Mysql. if the user has not modified the user name, the uid can be used as the default user name: entercodehere trigger, so you cannot modify your own table... DELIMITER | createtriggerdefault_nameafterinsertonuserforeachrowbeginupdateusersetnew.user_namene1_uid; END | a data entry is inserted and the following error occurs: can & #39; tupdate or another mysql trigger

I have set a trigger in Mysql to use uid as the default user name without modifying the user name:

Enter code here
/// The trigger cannot modify its own table...

DELIMITER |

Create trigger default_name after insert on user
FOR EACH ROW BEGIN
Update user set NEW. user_name = NEW. uid;

END
|
Then, a piece of data is inserted and the following error occurs:
Can't update ,,
CSDN mobile Q &

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.