﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31565	Support GENERATED ALWAYS columns for MySQL and PostgreSQL	Louise Grandjonc	nobody	"Hi,

in Postgres 12, generated columns have been added: https://www.postgresql.org/docs/12/ddl-generated-columns.html 

The value of a generated column is computed from other columns. A generated column can be either stored (in which case it takes up space, and is written/updated like any other column) or virtual.

Here is the example in the postgres docs to create such columns: 


{{{
CREATE TABLE people (
    ...,
    height_cm numeric,
    height_in numeric GENERATED ALWAYS AS (height_cm / 2.54) STORED
);
}}}

I would love to contribute and add this feature. And I'd like to know a bit what other think in terms of design:
Maybe the expression could be a string:

{{{
class People(models.Model):
    height_cm = models.FloatField()
    height_in = models.FloatField(always_generated='height_cm / 2.54', stored=True)
}}}

Best,
Louise
"	New feature	closed	Database layer (models, ORM)	dev	Normal	duplicate			Accepted	0	0	0	0	0	0
