]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
polymorphic union uses the literal_column function for its "textual" column
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 4 Feb 2007 03:50:54 +0000 (03:50 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 4 Feb 2007 03:50:54 +0000 (03:50 +0000)
lib/sqlalchemy/orm/util.py

index 3ac1ac7f66ab093b9342a073afb55d758c154a7c..293ec03770d84277d031b62d5feb25d13b41b34a 100644 (file)
@@ -59,7 +59,7 @@ def polymorphic_union(table_map, typecolname, aliasname='p_union'):
     result = []
     for type, table in table_map.iteritems():
         if typecolname is not None:
-            result.append(sql.select([col(name, table) for name in colnames] + [sql.column("'%s'" % type).label(typecolname)], from_obj=[table]))
+            result.append(sql.select([col(name, table) for name in colnames] + [sql.literal_column("'%s'" % type).label(typecolname)], from_obj=[table]))
         else:
             result.append(sql.select([col(name, table) for name in colnames], from_obj=[table]))
     return sql.union_all(*result).alias(aliasname)