diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-06-22 17:52:13 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-06-22 17:52:13 +0000 |
| commit | 8c1f08c8aa9f7fe8253323a457b207a260435dde (patch) | |
| tree | a488225413d51453d31f0d56e08ca606cb45b7d0 /test/sql/constraints.py | |
| parent | b2b754c2ce3a9672a135f01246dcb9521a88e2c4 (diff) | |
| download | sqlalchemy-8c1f08c8aa9f7fe8253323a457b207a260435dde.tar.gz | |
merged r4870 from 0.4 branch, index name truncation, [ticket:820]
Diffstat (limited to 'test/sql/constraints.py')
| -rw-r--r-- | test/sql/constraints.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sql/constraints.py b/test/sql/constraints.py index 5ce5cca34..b719ac93d 100644 --- a/test/sql/constraints.py +++ b/test/sql/constraints.py @@ -201,7 +201,25 @@ class ConstraintTest(TestBase, AssertsExecutionResults): winner='sweden') ss = events.select().execute().fetchall() + def test_too_long_idx_name(self): + dialect = testing.db.dialect.__class__() + dialect.max_identifier_length = 20 + schemagen = dialect.schemagenerator(dialect, None) + schemagen.execute = lambda : None + + t1 = Table("sometable", MetaData(), Column("foo", Integer)) + schemagen.visit_index(Index("this_name_is_too_long_for_what_were_doing", t1.c.foo)) + self.assertEquals(schemagen.buffer.getvalue(), "CREATE INDEX this_name_is_t_1 ON sometable (foo)") + schemagen.buffer.truncate(0) + schemagen.visit_index(Index("this_other_name_is_too_long_for_what_were_doing", t1.c.foo)) + self.assertEquals(schemagen.buffer.getvalue(), "CREATE INDEX this_other_nam_2 ON sometable (foo)") + + schemadrop = dialect.schemadropper(dialect, None) + schemadrop.execute = lambda: None + self.assertRaises(exc.IdentifierError, schemadrop.visit_index, Index("this_name_is_too_long_for_what_were_doing", t1.c.foo)) + + class ConstraintCompilationTest(TestBase, AssertsExecutionResults): class accum(object): def __init__(self): |
