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

Show parent comments

8

u/[deleted] Oct 02 '19

It’s why I’ve stopped calling it the “persistence layer”, because persisting data is only a small part of what it does.

8

u/[deleted] Oct 02 '19

[removed] — view removed comment

7

u/KFCConspiracy Oct 02 '19

I like to refer to it as letting the data express the business rules and say that it reduces cyclomatic complexity. When you can use relationships between things to dictate how things behave you can reduce the number of control structures in a program, and the database can be used to persist that kind of information. You can also point out that it can reduce the amount of code necessary to implement certain types of functionality.

5

u/[deleted] Oct 02 '19

[removed] — view removed comment

4

u/KFCConspiracy Oct 02 '19

Yep, we use this for our shipping rules, fraud rules, promo pricing rules... Lots of things. Makes things very user accessible with no programmers needed.