mirror of https://github.com/django/django.git
Fixed #34769 -- Fixed key transforms on Oracle 21c+.
Oracle 21c introduced support for primivites in JSON fields that caused changes in handling them by JSON_QUERY/JSON_VALUE functions.
This commit is contained in:
parent
f50184a84b
commit
8d2c16252e
|
@ -352,10 +352,13 @@ class KeyTransform(Transform):
|
|||
def as_oracle(self, compiler, connection):
|
||||
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
||||
json_path = compile_json_path(key_transforms)
|
||||
return (
|
||||
"COALESCE(JSON_QUERY(%s, '%s'), JSON_VALUE(%s, '%s'))"
|
||||
% ((lhs, json_path) * 2)
|
||||
), tuple(params) * 2
|
||||
if connection.features.supports_primitives_in_json_field:
|
||||
sql = (
|
||||
"COALESCE(JSON_VALUE(%s, '%s'), JSON_QUERY(%s, '%s' DISALLOW SCALARS))"
|
||||
)
|
||||
else:
|
||||
sql = "COALESCE(JSON_QUERY(%s, '%s'), JSON_VALUE(%s, '%s'))"
|
||||
return sql % ((lhs, json_path) * 2), tuple(params) * 2
|
||||
|
||||
def as_postgresql(self, compiler, connection):
|
||||
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
||||
|
|
Loading…
Reference in New Issue