diff options
| author | VIZZARD-X <vigneshanandmay13@gmail.com> | 2025-11-22 15:57:33 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-12-26 21:59:10 +0100 |
| commit | da19b3897dc7c2e99b120d40322b36b4f1a09fe8 (patch) | |
| tree | f080eda358cdb19733eb016660fa9a9a728aebd3 /django | |
| parent | 6c2780ffe1aaf526e01287f9d0805143c23c7920 (diff) | |
Fixed #36112 -- Added fallback in last_executed_query() on Oracle and PostgreSQL.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/oracle/operations.py | 6 | ||||
| -rw-r--r-- | django/db/backends/postgresql/operations.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index b3e28b102f..75f80941b3 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -352,7 +352,11 @@ END; statement = statement.replace( key, force_str(params[key], errors="replace") ) - return statement + return ( + super().last_executed_query(cursor, sql, params) + if statement is None + else statement + ) def last_insert_id(self, cursor, table_name, pk_name): sq_name = self._get_sequence_name(cursor, strip_quotes(table_name), pk_name) diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 91456e3daf..5f4eda905f 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -302,11 +302,11 @@ class DatabaseOperations(BaseDatabaseOperations): try: return self.compose_sql(sql, params) except errors.DataError: - return None + return super().last_executed_query(cursor, sql, params) else: if cursor._query and cursor._query.query is not None: return cursor._query.query.decode() - return None + return super().last_executed_query(cursor, sql, params) else: @@ -315,7 +315,7 @@ class DatabaseOperations(BaseDatabaseOperations): # The query attribute is a Psycopg extension to the DB API 2.0. if cursor.query is not None: return cursor.query.decode() - return None + return super().last_executed_query(cursor, sql, params) if is_psycopg3: |
