diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-04 17:37:36 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-04 17:37:36 -0500 |
commit | d5cc2f83c1183eb65d0daac3532a1645d0cd9513 (patch) | |
tree | 627f42c47b5d4222168006e9b9077d25c8a67d30 /test/dialect/test_postgresql.py | |
parent | 4f1274fc1fc675e2a482b68d658b36597f243c31 (diff) | |
download | sqlalchemy-d5cc2f83c1183eb65d0daac3532a1645d0cd9513.tar.gz |
- When explicit sequence execution derives the name
of the auto-generated sequence of a SERIAL column,
which currently only occurs if implicit_returning=False,
now accommodates if the table + column name is greater
than 63 characters using the same logic Postgresql uses.
[ticket:1083]
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index f8ca65e60..9aa281979 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -17,7 +17,7 @@ import logging class SequenceTest(TestBase, AssertsCompiledSQL): - def test_basic(self): + def test_format(self): seq = Sequence('my_seq_no_schema') dialect = postgresql.PGDialect() assert dialect.identifier_preparer.format_sequence(seq) \ @@ -29,6 +29,24 @@ class SequenceTest(TestBase, AssertsCompiledSQL): assert dialect.identifier_preparer.format_sequence(seq) \ == '"Some_Schema"."My_Seq"' + @testing.only_on('postgresql', 'foo') + @testing.provide_metadata + def test_reverse_eng_name(self): + engine = engines.testing_engine(options=dict(implicit_returning=False)) + for tname, cname in [ + ('tb1' * 30, 'abc'), + ('tb2', 'abc' * 30), + ('tb3' * 30, 'abc' * 30), + ('tb4', 'abc'), + ]: + t = Table(tname[:57], + metadata, + Column(cname[:57], Integer, primary_key=True) + ) + t.create(engine) + r = engine.execute(t.insert()) + assert r.inserted_primary_key == [1] + class CompileTest(TestBase, AssertsCompiledSQL): __dialect__ = postgresql.dialect() |