📜  在 postgresql 中触发以更改传入条目 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:08.159000             🧑  作者: Mango

代码示例1
CREATE or REPLACE FUNCTION func()
RETURNS TRIGGER
AS $$
BEGIN
NEW.columnname = 0;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;

-- Statement to make trigger to execute above code --
CREATE TRIGGER change_incoming BEFORE INSERT on Tablename 
FOR EACH ROW EXECUTE PROCEDURE func();