Docs for Generated Columns

Started by Tobias Bussmannover 7 years ago4 messagesdocs
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedsuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t76484
psql -h localhost -U postgres

Built from patchset v3 (message #3), July 28, 2026 at 01:39 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t76484_3 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t76484_3 && git checkout t76484_3

Patchset v3 (message #3) is on t76484_3

Jump to latest
#1Tobias Bussmann
t.bussmann@gmx.net

Hi,

while reading though the docs of the upcoming pg12 features, I stumbled upon some wording regarding generated columns:

both in create_table.sgml [1]https://www.postgresql.org/docs/devel/sql-createtable.html and create_foreign_table.sgml [2]https://www.postgresql.org/docs/devel/sql-createforeigntable.html the paragraph for the GENERATED ALWAYS AS clause is introduced with

This clause creates the column as a generated column. The column cannot be written to, and when read it will be computed from the specified expression.

To me this sounds confusing, if not wrong. Till v8 of the patch were STORED and VIRTUAL generated columns were described afterwards this was less obvious but now with only STORED it sounds like a reference to the VIRTUAL variant. Not being I native english speaker I'm restrained to send a patch but may I suggest the following for discussion:

The column cannot be written to, and when read the result of the specified expression will be returned.

Best regards
Tobias Bussmann

[1]: https://www.postgresql.org/docs/devel/sql-createtable.html
[2]: https://www.postgresql.org/docs/devel/sql-createforeigntable.html

#2Joe Conway
mail@joeconway.com
In reply to: Tobias Bussmann (#1)
Re: Docs for Generated Columns

On 5/23/19 5:50 PM, Tobias Bussmann wrote:

while reading though the docs of the upcoming pg12 features, I
stumbled upon some wording regarding generated columns: both in
create_table.sgml [1] and create_foreign_table.sgml [2] the paragraph
for the GENERATED ALWAYS AS clause is introduced with

This clause creates the column as a generated column. The column
cannot be written to, and when read it will be computed from the
specified expression.

To me this sounds confusing, if not wrong. Till v8 of the patch were
STORED and VIRTUAL generated columns were described afterwards this
was less obvious but now with only STORED it sounds like a reference
to the VIRTUAL variant.

No doubt this is flat out wrong.

Not being I native english speaker I'm restrained to send a patch but
may I suggest the following for discussion:

The column cannot be written to, and when read the result of the
specified expression will be returned.

That sounds reasonable to me.

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

#3Tobias Bussmann
t.bussmann@gmx.net
In reply to: Joe Conway (#2)
Re: Docs for Generated Columns

On 24.05.2019 14:21, Joe Conway <mail@joeconway.com> wrote:

The column cannot be written to, and when read the result of the
specified expression will be returned.

That sounds reasonable to me.

Thank you for confirmation and review. Please find attached my proposed little doc patch for this issue.

Tobias

Attachments:

t76484_3
001-reword-gen-col-docs.patchapplication/octet-stream; name=001-reword-gen-col-docs.patch; x-unix-mode=0644Download+4-4
#4Peter Eisentraut
peter_e@gmx.net
In reply to: Tobias Bussmann (#3)
Re: Docs for Generated Columns

On 2019-05-26 16:42, Tobias Bussmann wrote:

On 24.05.2019 14:21, Joe Conway <mail@joeconway.com> wrote:

The column cannot be written to, and when read the result of the
specified expression will be returned.

That sounds reasonable to me.

Thank you for confirmation and review. Please find attached my proposed little doc patch for this issue.

committed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services