Mike Bayer avatar Mike Bayer committed eb58107

- Fixed bug where index reflection would mis-interpret indkey values
when using the pypostgresql adapter, which returns these values
as lists vs. psycopg2's return type of string.
[ticket:2855]

Conflicts:
doc/build/changelog/changelog_09.rst
lib/sqlalchemy/__init__.py

Comments (0)

Files changed (3)

doc/build/changelog/changelog_08.rst

     .. include:: changelog_07.rst
 
 .. changelog::
+    :version: 0.8.4
+
+    .. change::
+        :tags: bug, postgresql
+        :tickets: 2855
+        :versions: 0.9.0b2
+
+        Fixed bug where index reflection would mis-interpret indkey values
+        when using the pypostgresql adapter, which returns these values
+        as lists vs. psycopg2's return type of string.
+
+.. changelog::
     :version: 0.8.3
     :released: October 26, 2013
 

lib/sqlalchemy/__init__.py

 __all__ = sorted(name for name, obj in locals().items()
                  if not (name.startswith('_') or _inspect.ismodule(obj)))
 
-__version__ = '0.8.3'
+__version__ = '0.8.4'
 
 del _inspect, sys
 

lib/sqlalchemy/dialects/postgresql/base.py

         table_oid = self.get_table_oid(connection, table_name, schema,
                                        info_cache=kw.get('info_cache'))
 
+        # cast indkey as varchar since it's an int2vector,
+        # returned as a list by some drivers such as pypostgresql
+
         IDX_SQL = """
           SELECT
               i.relname as relname,
               ix.indisunique, ix.indexprs, ix.indpred,
-              a.attname, a.attnum, ix.indkey
+              a.attname, a.attnum, ix.indkey::varchar
           FROM
               pg_class t
                     join pg_index ix on t.oid = ix.indrelid
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.