1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #27222 -- Refreshed GeneratedFields values on save() initiated update.

This required implementing UPDATE RETURNING machinery that heavily
borrows from the INSERT one.
This commit is contained in:
Simon Charette
2025-03-19 01:11:34 -04:00
committed by Mariusz Felisiak
parent c48904a225
commit 55a0073b3b
12 changed files with 213 additions and 59 deletions

View File

@@ -1315,12 +1315,6 @@ materialized view.
PostgreSQL only supports persisted columns. Oracle only supports virtual
columns.
.. admonition:: Refresh the data
Since the database computes the value, the object must be reloaded to
access the new value after :meth:`~Model.save`, for example, by using
:meth:`~Model.refresh_from_db`.
.. admonition:: Database limitations
There are many database-specific restrictions on generated fields that
@@ -1338,6 +1332,12 @@ materialized view.
.. _PostgreSQL: https://www.postgresql.org/docs/current/ddl-generated-columns.html
.. _SQLite: https://www.sqlite.org/gencol.html#limitations
.. versionchanged:: 6.0
``GeneratedField``\s are now automatically refreshed from the database on
backends that support it (SQLite, PostgreSQL, and Oracle) and marked as
deferred otherwise.
``GenericIPAddressField``
-------------------------