#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
-
自治事务函数不支持返回非out形式的record类型。
-
不支持修改自治事务的隔离级别。
-
不支持自治事务返回集合类型(setof)。
create table test_in (id int,a date); create table test_main (id int,a date); insert into test_main values (1111,'2021-01-01'),(2222,'2021-02-02'); truncate test_in,test_main; CREATE OR REPLACE FUNCTION autonomous_f_022(num1 int) RETURNS SETOF test_in LANGUAGE plpgsql AS $$ DECLARE count int :=3; test_row test_in%ROWTYPE; PRAGMA AUTONOMOUS_TRANSACTION; BEGIN while true loop if count=3 then null; else if count=2 then insert into test_main values (count,'2021-03-03'); goto pos1; end if; end if; count=count-1; end loop; insert into test_main values (1000,'2021-04-04'); <<pos1>> for test_row in select * from test_main loop return next test_row; end loop; return; END; $$ ;
#openGauss #入门 #安装 #数据库 #开源