| 1978 | return (template % placeholders).rstrip(), params |
| 1979 | |
| 1980 | def as_oracle(self, compiler, connection): |
| 1981 | # Oracle < 23c doesn't allow ORDER BY EXISTS() or filters unless it's |
| 1982 | # wrapped in a CASE WHEN. |
| 1983 | if ( |
| 1984 | not connection.features.supports_boolean_expr_in_select_clause |
| 1985 | and connection.ops.conditional_expression_supported_in_where_clause( |
| 1986 | self.expression |
| 1987 | ) |
| 1988 | ): |
| 1989 | copy = self.copy() |
| 1990 | copy.expression = Case( |
| 1991 | When(self.expression, then=True), |
| 1992 | default=False, |
| 1993 | ) |
| 1994 | return copy.as_sql(compiler, connection) |
| 1995 | return self.as_sql(compiler, connection) |
| 1996 | |
| 1997 | def get_group_by_cols(self): |
| 1998 | cols = [] |