Databases · Middle · Question 69 of 75

What is a generated column?

ALTER TABLE users
  ADD COLUMN email_lower text GENERATED ALWAYS AS (lower(email)) STORED;

Explanation

It can be indexed and can't get out of sync. Since PostgreSQL 18 generated columns can also be virtual (computed on read).

Further reading

Problem with a question

Databases · Middle · question 69

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz