diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-24 12:24:18 -0400 |
---|---|---|
committer | Stefan Urbanek <stefan@agentfarms.net> | 2015-08-25 23:56:08 -0700 |
commit | c8c7cd8073c5dbe8311bdb438b466cbdee8b77ab (patch) | |
tree | 0466463fd00ed5a4d4b427639cac6804359906c7 | |
parent | a3c97eabdc2ce58dfbf1de3cdcc1133a80a65626 (diff) | |
download | sqlalchemy-c8c7cd8073c5dbe8311bdb438b466cbdee8b77ab.tar.gz |
- 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
-rw-r--r-- | doc/build/changelog/changelog_10.rst | 15 | ||||
-rw-r--r-- | lib/sqlalchemy/__init__.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 4 | ||||
-rw-r--r-- | test/dialect/postgresql/test_reflection.py | 1 |
4 files changed, 20 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 2dce07b0a..593c26e00 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -16,6 +16,21 @@ :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 9b8d06167..ad96e7e69 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 dc7987d74..64d19eda1 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 0354fa436..ee87e7325 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""" |