How to update table when view is updated?

后端 未结 1 1372
一个人的身影
一个人的身影 2021-01-22 15:40

I want to update table when her view is updated. I use postgresql/postgis.

I create view.

CREATE VIEW filedata_view
AS SELECT num, id, ST_TRANSFORM(the_g         


        
相关标签:
1条回答
  • 2021-01-22 16:25

    For PostgreSQL 9.1 and above, use a DO INSTEAD trigger on the view. View triggers are much less difficult to get right and are less prone to weird problems with multiple evaluation, etc.

    For PostgreSQL 9.0 and below, you should use the rule system - see CREATE RULE ... DO INSTEAD. It is generally better to update to 9.1 and use a view trigger if you possibly can, especially for new users. Rules are tricky things.

    0 讨论(0)
提交回复
热议问题