如何在postgres函数中使用plpgsql递归返回表?不使用CTE/With Recursive

您所在的位置:网站首页 oracle递归查询上级父节点每行都要保存本节点 如何在postgres函数中使用plpgsql递归返回表?不使用CTE/With Recursive

如何在postgres函数中使用plpgsql递归返回表?不使用CTE/With Recursive

2024-07-10 11:54| 来源: 网络整理| 查看: 265

postgresql 触发器 简介(转)

– 把before for each row的触发器删掉, 再测试插入 : postgres=# drop trigger tg02 on t_ret; DROP TRIGGER postgres=# drop trigger tg2 on t_ret; DROP TRIGGER postgres=# insert into t_ret values(1,’digoal’,now()); NOTICE: 00000: tg01 LOCATION: exec_stmt_raise, pl_exec.c:2840 NOTICE: 00000: tg1 LOCATION: exec_stmt_raise, pl_exec.c:2840 NOTICE: 00000: tg03, after for each row 的触发器函数返回空, 不影响后续的触发器是否被调用. 因为只要表上面发生了真正的行操作, after for each row就会被触发, 除非when条件不满足. (这个后面会讲到) LOCATION: exec_stmt_raise, pl_exec.c:2840 NOTICE: 00000: tg3 LOCATION: exec_stmt_raise, pl_exec.c:2840 NOTICE: 00000: tg04 LOCATION: exec_stmt_raise, pl_exec.c:2840 NOTICE: 00000: tg4 LOCATION: exec_stmt_raise, pl_exec.c:2840 INSERT 0 1 – 有数据插入. 这也说明了before for each statement的返回值为空并不会影响数据库对行的操作. 只有before for each row的返回值会影响数据库对行的操作. postgres=# select * from t_ret ; id | info | crt_time —-+——–+—————————- 1 | digoal | 2013-03-10 16:50:39.551481 (1 row)

02


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3