#31300: Add Generated Columns (PostgreSQL) support
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
Dulmandakh |
Type: New | Status: new
feature |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
PostgreSQL 12 added support for Generated Columns, see
https://www.postgresql.org/docs/12/ddl-generated-columns.html. And I find
it very interesting and useful, for example with SearchVectorField.
I imagine it would be called GeneratedField and accept base_field as
ArrayField, then expression to generate a value for the field. For
example,
{{{
class Album(models.Model):
...
title = models.CharField(max_length=120)
search = GeneratedField(
SearchVectorField(),
F('title')
)
}}}
then generate SQL something like below.
{{{
CREATE TABLE album (
...
title char(120),
search tsvector GENERATED ALWAYS AS title STORED
);
}}}
I would like to work on this feature, but don't know how to pass
expression and generate migration using the expression.
--
Ticket URL: <https://code.djangoproject.com/ticket/31300>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.4e839b0bf0286459619ee73f66bbafa2%40djangoproject.com.