【发布时间】:2019-01-03 14:53:16
【问题描述】:
我在插入前触发器中有以下功能:
CREATE OR REPLACE FUNCTION schema.table_somefun()
RETURNS trigger AS
LANGUAGE 'plpgsql';
$BODY$
BEGIN
IF NEW.col2 NOT NULL THEN
NEW.col1 := CASE NEW.col1
WHEN '121432' THEN '321123'
ELSE <command> END CASE; --there should be a command aborting insertion without error or exception
END IF;
RETURN NEW;
END;
$BODY$
ELSE 语句应该中止插入。是否有一个命令可以删除查询而不告诉客户端并且保持表不变?
【问题讨论】:
-
RETURN NULL取消插入。
标签: sql postgresql database-trigger