Ticket #747 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

db.delete_unique() not worked for mysql 5.5

Reported by: ghoulr@… Owned by: andrew
Priority: critical Milestone: 1.0
Component: databaseapi Version: 0.7.3
Keywords: Cc:

Description

It seems the constraints check sql get a empty result set in mysql 5.5, I remote the table_catalog and migration works fine.

--- mysql.py.orig 2011-03-26 12:14:03.660000260 +0800
+++ mysql.py 2011-03-26 12:13:52.410000260 +0800
@@ -134,7 +134,6 @@ def _constraints_affecting_columns(self,

kc.constraint_name = c.constraint_name

WHERE

kc.table_schema = %s AND

  • kc.table_catalog IS NULL AND

kc.table_name = %s AND
c.constraint_type = %s

""", [db_name, table_name, type])

Change History

comment:1 in reply to: ↑ description Changed 3 years ago by ghoulr@…

Replying to ghoulr@…:

It seems the constraints check sql get a empty result set in mysql 5.5, I remote the table_catalog and migration works fine.

I removed the table_catalog check...

--- mysql.py.orig 2011-03-26 12:14:03.660000260 +0800
+++ mysql.py 2011-03-26 12:13:52.410000260 +0800
@@ -134,7 +134,6 @@ def _constraints_affecting_columns(self,

kc.constraint_name = c.constraint_name

WHERE

kc.table_schema = %s AND

  • kc.table_catalog IS NULL AND

kc.table_name = %s AND
c.constraint_type = %s

""", [db_name, table_name, type])

comment:2 Changed 3 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 1.0

comment:3 Changed 3 years ago by mail@…

Having just run into this, the root cause is a mysql bugfix (which changes table_catalog from NULL to 'def') is http://bugs.mysql.com/bug.php?id=35427, which tells us that this behavior occurs with mysql 5.1 >= 5.1.23-rc, mysql 5.0 >= 5.0.56, and most versions of mysql 6.x.

I can also confirm removing the table_catalog check works for me.

comment:4 follow-up: ↓ 5 Changed 3 years ago by andrew

The patch in the first comment makes no sense - there's no _constraints_affecting_columns function in mysql.py...

comment:5 in reply to: ↑ 4 Changed 3 years ago by ghoulr@…

Replying to andrew:

The patch in the first comment makes no sense - there's no _constraints_affecting_columns function in mysql.py...

Checked source code and yes this function removed in tip but actually in release version v0.7.3.
so if I installed south with pip or distro package managers such as apt-get, I cannot make it works with latest mysql out of box...

comment:6 Changed 3 years ago by Dan Fairs <dan@…>

For reference - I ran into this with South 0.7.3, but is resolved for me in 3c3f8b95c635.

comment:7 Changed 3 years ago by Dan Fairs <dan@…>

(Oops - that should have read, 'works for me by 3c3f8b95c635' - I didn't want to imply that particular changeset fixed it.)

comment:8 Changed 3 years ago by Christopher Grebs <cg@…>

This seems already be fixed in current trunk.

comment:9 Changed 3 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to fixed

Agreed.

comment:10 Changed 3 years ago by chris@…

Is there any chance we could get a new PyPI release which includes this fix? "pip install hg+https://bitbucket.org/andrewgodwin/south" works but is definitely living a bit dangerously.

comment:11 Changed 3 years ago by andrew

I plan to make a new release when Django 1.4 hits beta, as there's some compatability fixes in there, so it'll be pretty soon.

Note: See TracTickets for help on using tickets.