▲ | My Favorite PostgreSQL 18 Feature: Virtual Generated Columns(tselai.com) | ||||||||||||||||||||||
53 points by fforflo 3 days ago | 9 comments | |||||||||||||||||||||||
▲ | garyclarke27 2 days ago | parent | next [-] | ||||||||||||||||||||||
Stored generated columns would be much more useful if they could reference other rows and tables, they are limited to only the current row. Automatic incremental view maintenance would also solve this problem, but is unfortunately still a glaring omission in Postgres capabilities. | |||||||||||||||||||||||
▲ | saltcured 3 days ago | parent | prev | next [-] | ||||||||||||||||||||||
Aside from the SQL syntax, what is the difference between this and the longstanding virtual column feature, where you can define a function that takes the table's record type as input and return a scalar? PostgreSQL already let you use table.funcname as a virtual column, as I recall. | |||||||||||||||||||||||
| |||||||||||||||||||||||
▲ | icedchai 3 days ago | parent | prev | next [-] | ||||||||||||||||||||||
In the past, I've used views to add "virtual columns" where I didn't want to hard code them into the application. | |||||||||||||||||||||||
▲ | sgarland 3 days ago | parent | prev | next [-] | ||||||||||||||||||||||
Welp, that’s it. That was the last thing MySQL had that Postgres didn’t (modulo clustering index, which OrioleDB does, soooo…). Can’t wait! | |||||||||||||||||||||||
▲ | illegally 2 days ago | parent | prev [-] | ||||||||||||||||||||||
I don't really find these kind of features necessary. You can, and probably should, do these things in your application code. I mean, it's not really that hard to make a string lowercase, you don't need to define a "virtual colum" for that... | |||||||||||||||||||||||
|