Fixed #32392 -- Fixed ExclusionConstraint crash with Cast() in expressions.

This commit is contained in:
Tilman Koschnick 2021-01-28 17:50:54 +01:00 committed by Mariusz Felisiak
parent 135c800fe6
commit fdfbc66331
4 changed files with 15 additions and 23 deletions

View file

@ -42,12 +42,6 @@ class Cast(Func):
template = "JSON_EXTRACT(%(expressions)s, '$')"
return self.as_sql(compiler, connection, template=template, **extra_context)
def as_postgresql(self, compiler, connection, **extra_context):
# CAST would be valid too, but the :: shortcut syntax is more readable.
# 'expressions' is wrapped in parentheses in case it's a complex
# expression.
return self.as_sql(compiler, connection, template='(%(expressions)s)::%(db_type)s', **extra_context)
def as_oracle(self, compiler, connection, **extra_context):
if self.output_field.get_internal_type() == 'JSONField':
# Oracle doesn't support explicit cast to JSON.