pg 函数返回查询结果表

CREATE OR REPLACE FUNCTION "public"."fun_get_screen_data_source"("_screen" varchar)
  RETURNS TABLE("data_source" varchar) AS $BODY$
begin 
		if _screen = 'police' THEN
			return query select DISTINCT base_data_permission.data_source from base_data_permission where deleted = false and police_screen = TRUE;
		end if;
		
		if _screen = '' THEN
			return query select DISTINCT base_data_permission.data_source from base_data_permission where deleted = false;
		end if;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000
上一篇:[源码解析] PyTorch分布式(6) -------- DistributedDataParallel -- 初始化&store


下一篇:MVC模式:实现数据库中数据的增删改查功能