diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-20 17:53:13 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-20 17:53:13 -0400 |
commit | ef654af35ab2443172eb79e6f279792b72980539 (patch) | |
tree | b451a37ef81579643fb14382ee985d8477c07d8d /test/dialect/test_postgresql.py | |
parent | 6d14c69edca24cd4d726949011831db74601782d (diff) | |
download | sqlalchemy-ef654af35ab2443172eb79e6f279792b72980539.tar.gz |
- Fixed bug affecting PG 9 whereby index reflectionrel_0_7_0
would fail if against a column whose name
had changed. [ticket:2141]. Also in 0.6.8.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index a15fc63df..391f12022 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1541,6 +1541,28 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): 'expression-based index idx3' ]) + @testing.provide_metadata + def test_index_reflection_modified(self): + """reflect indexes when a column name has changed - PG 9 + does not update the name of the column in the index def. + [ticket:2141] + + """ + + metadata = self.metadata + + t1 = Table('t', metadata, + Column('id', Integer, primary_key=True), + Column('x', Integer) + ) + metadata.create_all() + conn = testing.db.connect().execution_options(autocommit=True) + conn.execute("CREATE INDEX idx1 ON t (x)") + conn.execute("ALTER TABLE t RENAME COLUMN x to y") + + ind = testing.db.dialect.get_indexes(conn, "t", None) + eq_(ind, [{'unique': False, 'column_names': [u'y'], 'name': u'idx1'}]) + conn.close() @testing.fails_on('+zxjdbc', 'psycopg2/pg8000 specific assertion') @testing.fails_on('pypostgresql', |