'Rails PostgreSQL check if column is virtual

PostgreSQL 12 has a cool Generated Columns feature but I can't check whether column is virtual or not in Rails.

For reference, MySQL Adapter in Rails allows you to do like

MyModel.supports_virtual_columns?
=> true
MyModel.columns.last.virtual?
=> false

But in PostgreSQL Adapter you can't do the same despite it does support Generated fields?

Rails v.5.1.7



Solution 1:[1]

the function is been added for postgresql since rails 7

so you could just do MyModel.columns.last.virtual? like when using mysql

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 buncis