mirror of
https://github.com/django/django.git
synced 2025-08-11 04:19:11 +00:00
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):
|
def as_oracle(self, compiler, connection):
|
||||||
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
||||||
json_path = compile_json_path(key_transforms)
|
json_path = compile_json_path(key_transforms)
|
||||||
return (
|
if connection.features.supports_primitives_in_json_field:
|
||||||
"COALESCE(JSON_QUERY(%s, '%s'), JSON_VALUE(%s, '%s'))"
|
sql = (
|
||||||
% ((lhs, json_path) * 2)
|
"COALESCE(JSON_VALUE(%s, '%s'), JSON_QUERY(%s, '%s' DISALLOW SCALARS))"
|
||||||
), tuple(params) * 2
|
)
|
||||||
|
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):
|
def as_postgresql(self, compiler, connection):
|
||||||
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user