Computed / calculated / virtual / derived columns in PostgreSQL

前端 未结 7 987
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 06:16

Does PostgreSQL support computed / calculated columns, like MS SQL Server? I can\'t find anything in the docs, but as this feature is included in many other DBMSs I thought

7条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 06:58

    Well, not sure if this is what You mean but Posgres normally support "dummy" ETL syntax. I created one empty column in table and then needed to fill it by calculated records depending on values in row.

    UPDATE table01
    SET column03 = column01*column02; /*e.g. for multiplication of 2 values*/
    
    1. It is so dummy I suspect it is not what You are looking for.
    2. Obviously it is not dynamic, you run it once. But no obstacle to get it into trigger.

提交回复
热议问题