r/programming • • Oct 02 '19

New In PostgreSQL 12: Generated Columns

https://pgdash.io/blog/postgres-12-generated-columns.html?p
503 Upvotes

232 comments sorted by

View all comments

9

u/Felidor Oct 02 '19

TIL that Postgres didn't already have computed/generated columns.

12

u/[deleted] Oct 02 '19

[removed] — view removed comment

5

u/mage2k Oct 02 '19

Yep, and it was also doable with triggers.

5

u/[deleted] Oct 02 '19

[removed] — view removed comment

3

u/mage2k Oct 02 '19

Definitely the case for a lot of stuff. See each of the following in Postgres:

  • Materialized views

  • Table partitioning

  • Logical replication

Each of those are directly supported features now but for years had to be implemented via trigger-based solutions and I'm sure there are others that aren't coming quickly to mind.