Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a workaround for not having computed columns, and you can even use a VIEW to present an interface that looks a lot like a table with computed columns, so it's pretty good, but you don't get persistence (the column will be computed every time it's required) and you don't get indexing.

Another workaround is to create a proper column and then ON INSERT OR UPDATE triggers that force NEW.that_column to have a computed value. This approach gets you persistent computed columns that you can index on.

What's surprising is that the new functionality in PG 12 doesn't support non-persistent computed columns, and that the other limitations (which are good) don't quite jive with the second workaround I mentioned.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: