From d5cc2f83c1183eb65d0daac3532a1645d0cd9513 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 4 Feb 2011 17:37:36 -0500 Subject: - 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] --- test/dialect/test_postgresql.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/dialect/test_postgresql.py') 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() -- cgit v1.2.1