1
0
mirror of https://github.com/django/django.git synced 2025-08-25 11:19:12 +00:00

Refs #470 -- Adjusted Field.db_returning to be backend agnostic.

Determining if a field is db_returning based on the default connection
feature availability prevents the usage of RETURNING for db_default
fields in setups where non-default backends do support RETURNING.

Whether or not the field should be attempted to be returned is already
checked at the compiler level which is backend aware.
This commit is contained in:
Simon Charette 2025-05-06 09:07:55 -04:00 committed by Mariusz Felisiak
parent b3166e1e15
commit 836894f27a

View File

@ -932,9 +932,7 @@ class Field(RegisterLookupMixin):
@property
def db_returning(self):
"""Private API intended only to be used by Django itself."""
return (
self.has_db_default() and connection.features.can_return_columns_from_insert
)
return self.has_db_default()
def set_attributes_from_name(self, name):
self.name = self.name or name