diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-28 11:54:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-28 11:54:01 +0200 |
| commit | 02447fb133b53ec7d0ff068cc08f06fdf8817ef7 (patch) | |
| tree | 780a999da5ffacb6ec1593dca42c2961a83ce7d2 /django | |
| parent | 628c4a26eee93417bb7161aa393dffb3f4c146b2 (diff) | |
Fixed #31835 -- Dropped support for JSONField __contains lookup on Oracle.
The current implementation works only for basic examples without
supporting nested structures and doesn't follow "the general principle
that the contained object must match the containing object as to
structure and data contents, possibly after discarding some
non-matching array elements or object key/value pairs from the
containing object".
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/json.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/django/db/models/fields/json.py b/django/db/models/fields/json.py index edc5441799..b82c6a82e2 100644 --- a/django/db/models/fields/json.py +++ b/django/db/models/fields/json.py @@ -146,24 +146,7 @@ class DataContains(PostgresOperatorLookup): return 'JSON_CONTAINS(%s, %s)' % (lhs, rhs), params def as_oracle(self, compiler, connection): - if isinstance(self.rhs, KeyTransform): - return HasKey(self.lhs, self.rhs).as_oracle(compiler, connection) - lhs, lhs_params = self.process_lhs(compiler, connection) - params = tuple(lhs_params) - sql = ( - "JSON_QUERY(%s, '$%s' WITH WRAPPER) = " - "JSON_QUERY('%s', '$.value' WITH WRAPPER)" - ) - rhs = json.loads(self.rhs) - if isinstance(rhs, dict): - if not rhs: - return "DBMS_LOB.SUBSTR(%s) LIKE '{%%%%}'" % lhs, params - return ' AND '.join([ - sql % ( - lhs, '.%s' % json.dumps(key), json.dumps({'value': value}), - ) for key, value in rhs.items() - ]), params - return sql % (lhs, '', json.dumps({'value': rhs})), params + raise NotSupportedError('contains lookup is not supported on Oracle.') class ContainedBy(PostgresOperatorLookup): |
