[SQL-CVS] [ sqlobject-Patches-1546314 ] Fix bug 1546294
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: SourceForge.net <no...@so...> - 2006-09-04 16:10:59
|
Patches item #1546314, was opened at 2006-08-25 02:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: Rick Copeland (rick446) Assigned to: Oleg Broytmann (phd) Summary: Fix bug 1546294 Initial Comment: Here is the patch that fixes bug 1546294. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-04 20:10 Message: Logged In: YES user_id=4799 I'dlike to wait until a clear test. You have reported that the test failed with psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" But I don't see any boolean there. Are you sure you've submitted the same test that produced the error message? Your test works for me with python 2.3 and 2.4, with SQLite and Postgres 7.4, with PySQLite1 and PySQLite2, psycopg1 and psycopg2. ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-04 19:40 Message: Logged In: YES user_id=1583356 Given that the test which I attached fails, what is the next step to resolve this issue? ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-04 18:29 Message: Logged In: YES user_id=4799 I rewrote the test to the SQLObject test suite: from sqlobject import * from sqlobject.inheritance import * from sqlobject.tests.dbtest import * class TestCascade1(InheritableSQLObject): dummy=IntCol() class TestCascade2(TestCascade1): c=ForeignKey('TestCascade3', cascade='null') class TestCascade3(SQLObject): dummy=IntCol() def test_destroySelf(): setupClass([TestCascade1, TestCascade3, TestCascade2]) c = TestCascade3(dummy=1) b = TestCascade2(cID=c.id, dummy=1) c.destroySelf() print b and it works even without your patch. So the test is invalid. This is the debugging output: ============================= test process starts ============================= testing-mode: inprocess executable: /usr/local/bin/python (2.4.3-final-0) using py lib: /usr/local/src/Python/py-dist/py <rev unknown> testDestroyCascade.py[1] inserting into sys.path: /usr/local/src/Python/py-dist 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade1' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/QueryR : CREATE TABLE test_cascade1 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade3' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/QueryR : CREATE TABLE test_cascade3 ( id SERIAL PRIMARY KEY, dummy INT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_cascade2' 1/COMMIT : auto 1/Query : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/QueryR : CREATE TABLE test_cascade2 ( id SERIAL PRIMARY KEY, child_name VARCHAR(255), c_id INT, CONSTRAINT c_id_exists FOREIGN KEY (c_id) REFERENCES test_cascade3 (id) ON DELETE SET NULL ) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade3 (id, dummy) VALUES (1, 1) 1/COMMIT : auto 1/QueryOne: SELECT dummy FROM test_cascade3 WHERE id = (1) 1/QueryR : SELECT dummy FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade1 (id, dummy, child_name) VALUES (1, 1, NULL) 1/COMMIT : auto 1/QueryOne: SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/QueryR : SELECT child_name, dummy FROM test_cascade1 WHERE id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/QueryR : UPDATE test_cascade1 SET child_name = ('TestCascade2') WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_cascade2 (id, child_name, c_id) VALUES (1, NULL, 1) 1/COMMIT : auto 1/QueryOne: SELECT child_name, c_id FROM test_cascade2. ================== tests finished: 1 passed in 0.28 seconds =================== WHERE id = (1) 1/QueryR : SELECT child_name, c_id FROM test_cascade2 WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/QueryR : SELECT test_cascade2.id, test_cascade2.child_name, test_cascade2.c_id FROM test_cascade2 WHERE c_id = (1) 1/COMMIT : auto 1/Query : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/QueryR : UPDATE test_cascade2 SET c_id = (NULL) WHERE id = (1) 1/COMMIT : auto 1/Query : DELETE FROM test_cascade3 WHERE id = (1) 1/QueryR : DELETE FROM test_cascade3 WHERE id = (1) 1/COMMIT : auto <TestCascade2 1L cID=None dummy=1> ---------------------------------------------------------------------- Comment By: Rick Copeland (rick446) Date: 2006-09-02 01:02 Message: Logged In: YES user_id=1583356 OK, here's a test that fails with the exception psycopg2.ProgrammingError: invalid input syntax for type boolean: "c_id = (1)" It appears to work OK on sqlite (my other test platform) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-09-01 19:26 Message: Logged In: YES user_id=4799 Please add a test or at least short test script that fails without the patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1546314&group_id=74338 |