liveBook · Manning

Stored generated column

As explained in Just Use Postgres!

A stored generated column is a table column whose value is automatically computed from an expression and physically stored.

A stored generated column automatically computes an expression and stores the result in the table. PostgreSQL regenerates the value whenever its source columns change. section 6.2.2

Indexing movie text as lexemes

Add a tsvector column derived from movie names and descriptions. The explicit english configuration keeps the expression immutable; coalesce converts NULL inputs to empty strings. section 6.2.2

How Just Use Postgres! covers it

How deep it goes
Explains automatic regeneration, immutable expressions, explicit text-search configuration, and NULL handling through executable SQL.
Examples
Uses an omdb.movies table and derives lexemes from the 2001: A Space Odyssey name and description.
What it assumes
Assumes an existing PostgreSQL table and SQL familiarity while explaining immutable expressions and NULL-safe input handling.
What you can do after
Build it from scratch by adding a PostgreSQL stored generated column with an immutable tsvector expression.
How it connects
Connects generated columns with PostgreSQL full-text search, tsvector, immutable functions, and NULL handling.

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.