Generated columns in PostgreSQL, introduced in version 12, allow data to be computed dynamically at the database level. There are two types: virtual and stored, though PostgreSQL only supports stored columns. This post provides an example of creating and using a generated column, explores when they are computed, and highlights some limitations, such as the inability to reference a generated column from another generated column and the use of constraints on generated columns.

4m read timeFrom hashrocket.com
Post cover image
Table of contents
What is a generated column?ExamplesWhen exactly is it computed?Some LimitationsSummary
1 Comment

Sort: