gpt4 book ai didi

postgresql 在触发器中设置默认值

转载 作者:行者123 更新时间:2023-11-29 12:23:56 25 4
gpt4 key购买 nike

我在表上有一个“更新前触发器”。如何在列上设置默认值? :

CREATE OR REPLACE FUNCTION trigger() RETURNS TRIGGER AS
$$

TD["new"]["test"] = DEFAULT # Doesn't work

$$ LANGUAGE plpython2u VOLATILE;

最佳答案

来自documentation :

... you can return None or "OK" from the Python function to indicate the row is unmodified, "SKIP" to abort the event, or [...] "MODIFY" to indicate you've modified the new row.

关于postgresql 在触发器中设置默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52181919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com