Skip to content

Commit 783e5a5

Browse files
author
Bartek Ogryczak
committed
unittest for dropped column issue
1 parent 4c48538 commit 783e5a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pymysqlreplication/tests/test_basic.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,28 @@ def test_drop_table(self):
563563

564564
self.assertEqual([], event.rows)
565565

566+
def test_drop_column(self):
567+
self.stream.close()
568+
self.execute("CREATE TABLE test_drop_column (id INTEGER(11), data VARCHAR(50))")
569+
self.execute("INSERT INTO test_drop_column VALUES (1, 'A value')")
570+
self.execute("COMMIT")
571+
self.execute("ALTER TABLE test_drop_column DROP COLUMN data")
572+
self.execute("INSERT INTO test_drop_column VALUES (2)")
573+
self.execute("COMMIT")
574+
575+
self.stream = BinLogStreamReader(
576+
self.database,
577+
server_id=1024,
578+
only_events=(WriteRowsEvent,),
579+
)
580+
try:
581+
self.stream.fetchone() # insert with two values
582+
self.stream.fetchone() # insert with one value
583+
except Exception as e:
584+
self.fail("raised unexpected exception: {exception}".format(exception=e))
585+
finally:
586+
self.resetBinLog()
587+
566588

567589
class TestGtidBinLogStreamReader(base.PyMySQLReplicationTestCase):
568590
def setUp(self):

0 commit comments

Comments
 (0)