]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Merge "Improve handling of covering indexes"
authormike bayer <mike_mp@zzzcomputing.com>
Sat, 12 Sep 2020 19:46:50 +0000 (19:46 +0000)
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>
Sat, 12 Sep 2020 19:46:50 +0000 (19:46 +0000)
1  2 
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/testing/requirements.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_reflection.py
test/requirements.py

index b398610b233fcfc18c5a27fa53b286f1feaac011,ae852f26431f4dd1120bc5096bc8f410259ad893..519d74d89eade3d667faff71f3e2a887241ad266
@@@ -2873,16 -2864,12 +2873,18 @@@ class MSDialect(default.DefaultDialect)
                  "name": row["name"],
                  "unique": row["is_unique"] == 1,
                  "column_names": [],
+                 "include_columns": [],
              }
 +
 +            if row["filter_definition"] is not None:
 +                indexes[row["index_id"]].setdefault("dialect_options", {})[
 +                    "mssql_where"
 +                ] = row["filter_definition"]
 +
          rp = connection.execution_options(future_result=True).execute(
              sql.text(
-                 "select ind_col.index_id, ind_col.object_id, col.name "
+                 "select ind_col.index_id, ind_col.object_id, col.name, "
+                 "ind_col.is_included_column "
                  "from sys.columns as col "
                  "join sys.tables as tab on tab.object_id=col.object_id "
                  "join sys.index_columns as ind_col on "
index 93ee7ca294a86960a9f79fa8e00c238402ebd1ea,ffd926c460b417603af0d09ac1a5077a414f2c9d..3ef87620fdb6a4d6314048004443be3c08f085d1
@@@ -2253,12 -2279,7 +2277,11 @@@ class PGDDLCompiler(compiler.DDLCompile
              text += " TABLESPACE %s" % preparer.quote(tablespace_name)
  
          whereclause = index.dialect_options["postgresql"]["where"]
          if whereclause is not None:
 +            whereclause = coercions.expect(
 +                roles.DDLExpressionRole, whereclause
 +            )
 +
              where_compiled = self.sql_compiler.process(
                  whereclause, include_table=False, literal_binds=True
              )
Simple merge