PostgreSQL's rules and nextval()/serial problem (very PostgreSQL-specific)

前端 未结 2 1177
暖寄归人
暖寄归人 2021-02-20 08:58

When I use a rewrite rule that splits an insert into one table into inserts to two other tables where one of the inserted values has as default nextval(\'some_sequence\') with t

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-20 09:47

    Rules will do that for you - they rewrite the query before it's executed.

    As long as you have an actual table for the base (Children1), I think you'll be able to accomplish the same thing with a TRIGGER instead of a RULE.

提交回复
热议问题