From 74f26d2279dc730f0a8a8cc9a7824465dd465626 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 17 Feb 2011 20:43:17 -0500 Subject: - Fixed regression from 0.6 where SMALLINT and BIGINT types would both generate SERIAL on an integer PK column, instead of SMALLINT and BIGSERIAL [ticket:2065] --- test/dialect/test_postgresql.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 1c7d0b16a..149421404 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1495,6 +1495,23 @@ class MiscTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): : Numeric}) assert_raises(exc.InvalidRequestError, testing.db.execute, stmt) + def test_serial_integer(self): + for type_, expected in [ + (Integer, 'SERIAL'), + (BigInteger, 'BIGSERIAL'), + (SmallInteger, 'SMALLINT'), + (postgresql.INTEGER, 'SERIAL'), + (postgresql.BIGINT, 'BIGSERIAL'), + ]: + m = MetaData() + + t = Table('t', m, Column('c', type_, primary_key=True)) + ddl_compiler = testing.db.dialect.ddl_compiler(testing.db.dialect, schema.CreateTable(t)) + eq_( + ddl_compiler.get_column_specification(t.c.c), + "c %s NOT NULL" % expected + ) + class TimezoneTest(TestBase): """Test timezone-aware datetimes. -- cgit v1.2.1