~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to lib/sqlalchemy/dialects/postgresql/base.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-10-28 22:29:40 UTC
  • mfrom: (1.4.24)
  • Revision ID: package-import@ubuntu.com-20131028222940-wvyqffl4g617caun
Tags: 0.8.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1101
1101
        text += "(%s)" \
1102
1102
                % (
1103
1103
                    ', '.join([
1104
 
                        self.sql_compiler.process(expr, include_table=False) +
1105
 
 
1106
 
 
 
1104
                        self.sql_compiler.process(
 
1105
                                expr.self_group()
 
1106
                                if not isinstance(expr, expression.ColumnClause)
 
1107
                                    else expr,
 
1108
                                include_table=False, literal_binds=True) +
1107
1109
                        (c.key in ops and (' ' + ops[c.key]) or '')
1108
 
 
1109
 
 
1110
1110
                        for expr, c in zip(index.expressions, index.columns)])
1111
1111
                    )
1112
1112
 
1116
1116
            whereclause = None
1117
1117
 
1118
1118
        if whereclause is not None:
1119
 
            whereclause = sql_util.expression_as_ddl(whereclause)
1120
 
            where_compiled = self.sql_compiler.process(whereclause)
 
1119
            where_compiled = self.sql_compiler.process(
 
1120
                                    whereclause, include_table=False,
 
1121
                                    literal_binds=True)
1121
1122
            text += " WHERE " + where_compiled
1122
1123
        return text
1123
1124
 
1132
1133
            elements.append(self.preparer.quote(c.name, c.quote)+' WITH '+op)
1133
1134
        text += "EXCLUDE USING %s (%s)" % (constraint.using, ', '.join(elements))
1134
1135
        if constraint.where is not None:
1135
 
            sqltext = sql_util.expression_as_ddl(constraint.where)
1136
 
            text += ' WHERE (%s)' % self.sql_compiler.process(sqltext)
 
1136
            text += ' WHERE (%s)' % self.sql_compiler.process(
 
1137
                                            constraint.where,
 
1138
                                            literal_binds=True)
1137
1139
        text += self.define_constraint_deferrability(constraint)
1138
1140
        return text
1139
1141
 
1545
1547
    def _get_server_version_info(self, connection):
1546
1548
        v = connection.execute("select version()").scalar()
1547
1549
        m = re.match(
1548
 
            '(?:PostgreSQL|EnterpriseDB) '
 
1550
            '.*(?:PostgreSQL|EnterpriseDB) '
1549
1551
            '(\d+)\.(\d+)(?:\.(\d+))?(?:\.\d+)?(?:devel)?',
1550
1552
            v)
1551
1553
        if not m:
1677
1679
        SQL_COLS = """
1678
1680
            SELECT a.attname,
1679
1681
              pg_catalog.format_type(a.atttypid, a.atttypmod),
1680
 
              (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid)
1681
 
                for 128)
 
1682
              (SELECT pg_catalog.pg_get_expr(d.adbin, d.adrelid)
1682
1683
                FROM pg_catalog.pg_attrdef d
1683
1684
               WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum
1684
1685
               AND a.atthasdef)