diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-08 20:06:58 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-08 20:06:58 -0400 |
commit | e74627f827542044c1d2087be95e41d4b1b46f24 (patch) | |
tree | 271f25fc6cc032008f2a61609b35a2f5e01dfa3e /test/sql/test_selectable.py | |
parent | 9df4651fba6d1cd3d2b490f58263cc45a81788f4 (diff) | |
download | sqlalchemy-e74627f827542044c1d2087be95e41d4b1b46f24.tar.gz |
A :func:`.select` that is made to refer to itself in its FROM clause,
typically via in-place mutation, will raise an informative error
message rather than causing a recursion overflow.
[ticket:2815]
Diffstat (limited to 'test/sql/test_selectable.py')
-rw-r--r-- | test/sql/test_selectable.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 87a226782..0fc7a0ed0 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -514,6 +514,18 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled "SELECT c FROM (SELECT (SELECT (SELECT table1.col1 AS a FROM table1) AS b) AS c)" ) + def test_self_referential_select_raises(self): + t = table('t', column('x')) + + s = select([t]) + + s.append_whereclause(s.c.x > 5) + assert_raises_message( + exc.InvalidRequestError, + r"select\(\) construct refers to itself as a FROM", + s.compile + ) + def test_unusual_column_elements_text(self): """test that .c excludes text().""" |