From: Mike Bayer Date: Fri, 24 Jul 2015 16:24:18 +0000 (-0400) Subject: - An adjustment to the new Postgresql feature of reflecting storage X-Git-Tag: rel_1_0_9~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e092e339463e6c6e02cf85266ca49ab1c32832f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - An adjustment to the new Postgresql feature of reflecting storage options and USING of :ticket:`3455` released in 1.0.6, to disable the feature for Postgresql versions < 8.2 where the ``reloptions`` column is not provided; this allows Amazon Redshift to again work as it is based on an 8.0.x version of Postgresql. Fix courtesy Pete Hollobon. references #3455 --- diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 2dce07b0a5..593c26e001 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -15,6 +15,21 @@ .. include:: changelog_07.rst :start-line: 5 +.. changelog:: + :version: 1.0.9 + + .. change:: + :tags: bug, postgresql + :pullreq: github:190 + + An adjustment to the new Postgresql feature of reflecting storage + options and USING of :ticket:`3455` released in 1.0.6, + to disable the feature for Postgresql versions < 8.2 where the + ``reloptions`` column is not provided; this allows Amazon Redshift + to again work as it is based on an 8.0.x version of Postgresql. + Fix courtesy Pete Hollobon. + + .. changelog:: :version: 1.0.8 :released: July 22, 2015 diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 9b8d06167c..ad96e7e690 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -120,7 +120,7 @@ from .schema import ( from .inspection import inspect from .engine import create_engine, engine_from_config -__version__ = '1.0.8' +__version__ = '1.0.9' def __go(lcls): diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index dc7987d741..64d19eda1c 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2641,7 +2641,7 @@ class PGDialect(default.DefaultDialect): i.relname as relname, ix.indisunique, ix.indexprs, ix.indpred, a.attname, a.attnum, NULL, ix.indkey%s, - i.reloptions, am.amname + %s, am.amname FROM pg_class t join pg_index ix on t.oid = ix.indrelid @@ -2664,6 +2664,8 @@ class PGDialect(default.DefaultDialect): # cast does not work in PG 8.2.4, does work in 8.3.0. # nothing in PG changelogs regarding this. "::varchar" if self.server_version_info >= (8, 3) else "", + "i.reloptions" if self.server_version_info >= (8, 2) + else "NULL", self._pg_index_any("a.attnum", "ix.indkey") ) else: diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py index 0354fa436a..ee87e73257 100644 --- a/test/dialect/postgresql/test_reflection.py +++ b/test/dialect/postgresql/test_reflection.py @@ -673,6 +673,7 @@ class ReflectionTest(fixtures.TestBase): eq_(ind, [{'unique': False, 'column_names': ['y'], 'name': 'idx1'}]) conn.close() + @testing.fails_if("postgresql < 8.2", "reloptions not supported") @testing.provide_metadata def test_index_reflection_with_storage_options(self): """reflect indexes with storage options set"""