Changing UNIQUE_CHECKS, FOREIGN_KEY_CHECKS & SQL_MODE
Posted by: John Rocha
Date: November 21, 2012 11:24AM

I have a question/concern.

My organization often uses the output from Workbench's "create alter script" export ability as the basis for their alter scripts. They start with what workbench provides and then add their own additional SQL commands.

In the workbench output I see the following near the top of the script

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

and at the end there are commands that to restore the old values.

I found the explanation for these changes at:
http://dev.mysql.com/doc/workbench/en/workbench-faq.html

However, my concern is..... what if the script fails in the middle. Doesn't that mean that the we never restore the old values for these variables? And isn't that bad?

Options: ReplyQuote


Subject
Written By
Posted
Changing UNIQUE_CHECKS, FOREIGN_KEY_CHECKS & SQL_MODE
November 21, 2012 11:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.