Re: Virtual Generated Columns

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: andy(dot)hardin(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Virtual Generated Columns
Date: 2025-12-08 18:39:52
Message-ID: ee6ab73a-ba54-4f02-bbad-47eeb3cff162@ewie.name
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2025-12-08 19:36:43 Re: Inclusion of json in list of standard data types
Previous Message Erik Wienhold 2025-12-08 18:33:42 Re: Inclusion of json in list of standard data types