Virtual Generated Columns

Started by PG Bug reporting form5 months ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/ddl-generated-columns.html
Description:

The documentation for generated columns in PostgreSQL versions prior to 18
mention "virtual" columns, but as far as I can tell, this is not available
prior to 18.

In v17, this is just in the first paragraph.

A generated column is a special column that is always computed from other

columns. Thus, it is for columns what a view is for tables. There are two
kinds of generated columns: stored and virtual. A stored generated column is
computed when it is written (inserted or updated) and occupies storage as if
it were a normal column. A virtual generated column occupies no storage and
is computed when it is read. Thus, a virtual generated column is similar to
a view and a stored generated column is similar to a materialized view
(except that it is always updated automatically). PostgreSQL currently
implements only stored generated columns.

#2Erik Wienhold
ewie@ewie.name
In reply to: PG Bug reporting form (#1)
Re: Virtual Generated Columns

On 2025-12-05 14:57 +0100, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/ddl-generated-columns.html
Description:

The documentation for generated columns in PostgreSQL versions prior to 18
mention "virtual" columns, but as far as I can tell, this is not available
prior to 18.

In v17, this is just in the first paragraph.

A generated column is a special column that is always computed from other

columns. Thus, it is for columns what a view is for tables. There are two
kinds of generated columns: stored and virtual. A stored generated column is
computed when it is written (inserted or updated) and occupies storage as if
it were a normal column. A virtual generated column occupies no storage and
is computed when it is read. Thus, a virtual generated column is similar to
a view and a stored generated column is similar to a materialized view
(except that it is always updated automatically). PostgreSQL currently
implements only stored generated columns.

The last sentence correctly states that Postgres v17- does not implement
virtual columns. The paragraph is meant as a general overview because
other RDBMS at that time had already implemented both flavors, e.g.
SQLite.

--
Erik Wienhold