From e1d09859c55576f507e75960504719d17a46779c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 23 Sep 2012 13:42:24 -0400 Subject: - [bug] Columns in reflected primary key constraint are now returned in the order in which the constraint itself defines them, rather than how the table orders them. Courtesy Gunnlaugur Por Briem. [ticket:2531]. --- test/dialect/test_postgresql.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 0bd6666e2..73633c128 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1439,6 +1439,21 @@ class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL): class ReflectionTest(fixtures.TestBase): __only_on__ = 'postgresql' + @testing.fails_if(('postgresql', '<', (8, 4)), + "newer query is bypassed due to unsupported SQL functions") + @testing.provide_metadata + def test_reflected_primary_key_order(self): + meta1 = self.metadata + subject = Table('subject', meta1, + Column('p1', Integer, primary_key=True), + Column('p2', Integer, primary_key=True), + PrimaryKeyConstraint('p2', 'p1') + ) + meta1.create_all() + meta2 = MetaData(testing.db) + subject = Table('subject', meta2, autoload=True) + eq_(subject.primary_key.columns.keys(), [u'p2', u'p1']) + @testing.provide_metadata def test_pg_weirdchar_reflection(self): meta1 = self.metadata -- cgit v1.2.1