]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- An adjustment to the new Postgresql feature of reflecting storage
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Jul 2015 16:24:18 +0000 (12:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Jul 2015 16:24:18 +0000 (12:24 -0400)
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

doc/build/changelog/changelog_10.rst
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_reflection.py

index 2dce07b0a5db67530462bd7975b07628422fa72d..593c26e00108ae2d1c7edd6cfc826010aed2a323 100644 (file)
     .. 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
index 9b8d06167c4e5246d319994bdb42950e96013b0e..ad96e7e690a36a6c3bcdfb4c3d16fd09a2e706df 100644 (file)
@@ -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):
index dc7987d74181e7a91bf7162ddb1c9c0cf8c282c0..64d19eda1c2a7f9f0d36386dc55bd906cb83df48 100644 (file)
@@ -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:
index 0354fa436aec1a7f543b97e58d0f97237eade901..ee87e73257cebecfa048402389f2e0fd1329b08c 100644 (file)
@@ -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"""