diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-01-06 18:50:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-06 18:50:54 +0100 |
| commit | 8f8a93a9ae49fa807348f9f456b6635c8ebc5d0c (patch) | |
| tree | 5868485e67257c507395f1a9321cb9ddab25e313 /django | |
| parent | 777f216d555496798a1e65fd899b0f8a0349aeca (diff) | |
Fixed #28859 -- Made Oracle backend raise DatabaseError if "no data found" exception is hidden by the Oracle OCI library.
Thanks Tim Graham for the review and Jani Tiainen for the report.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/oracle/operations.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 1b0c6e9ed8..bea03e355e 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -5,6 +5,7 @@ import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name +from django.db.utils import DatabaseError from django.utils import timezone from django.utils.encoding import force_bytes @@ -217,7 +218,14 @@ END; return " DEFERRABLE INITIALLY DEFERRED" def fetch_returned_insert_id(self, cursor): - return int(cursor._insert_id_var.getvalue()) + try: + return int(cursor._insert_id_var.getvalue()) + except TypeError: + raise DatabaseError( + 'The database did not return a new row id. Probably "ORA-1403: ' + 'no data found" was raised internally but was hidden by the ' + 'Oracle OCI library (see https://code.djangoproject.com/ticket/28859).' + ) def field_cast_sql(self, db_type, internal_type): if db_type and db_type.endswith('LOB'): |
