9

Can't really find any details on this, but is the scope of 'SET foreign_key_checks = 0' the current connection, current session or current transaction?

sbrattla
  • 5,274
  • 3
  • 39
  • 63
  • 1
    I'd say that my question is formulated better than the one referred to above. At least my question ends with a question mark... – sbrattla Aug 16 '13 at 20:19

2 Answers2

8

It's a session-based statement.

This is to temporarily break the Foreign Key Constraint. It is sometimes necessary to change data in a way that referential integrity needs to be broken during the modification process.

John Woo
  • 258,903
  • 69
  • 498
  • 492
7

It is session-based. Full answer and explanation can be found in this other Stack Overflow answer:

“It is session-based. Do a test to be sure, but that's my understanding of it.”

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103