Hi,
We noticed that in our MySQL database ON DELETE CASCADE is not working
when a row is deleted by web2py controller.
It is working ok when I run SQL delete from mysql console.
Because of that, it is possible to get database into inconsistent
state with web2py
When looking into this problem I noticed self._execute('SET
FOREIGN_KEY_CHECKS=0;') in web2py source:
web2py$ grep -n -A 2 -B 10 -e "FOREIGN_KEY_CHECKS" -R *
gluon/sql.py-870- self._pool_connection(lambda :
MySQLdb.Connection(
gluon/sql.py-871- db=db,
gluon/sql.py-872- user=user,
gluon/sql.py-873- passwd=passwd,
gluon/sql.py-874- host=host,
gluon/sql.py-875- port=int(port),
gluon/sql.py-876- charset=charset,
gluon/sql.py-877- ))
gluon/sql.py-878- self._cursor = self._connection.cursor()
gluon/sql.py-879- self._execute = lambda *a, **b:
self._cursor.execute(*a, **b)
gluon/sql.py:880: self._execute('SET
FOREIGN_KEY_CHECKS=0;')
gluon/sql.py-881- self._execute("SET
sql_mode='NO_BACKSLASH_ESCAPES';")
gluon/sql.py-882- elif not is_jdbc and self._uri[:11] ==
'postgres://':
What is the rationale for self._execute('SET FOREIGN_KEY_CHECKS=0;')
there?
I'd like to have my database consistent and ON DELETE CASCADE working
-
can I/ should I change it to =1 ?
I've found a discussion about FOREIGN_KEY_CHECKS in web2py
here ...but not sure if it's related.
http://markmail.org/message/6472owgwupttlblq
Regards,
Maciek
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.