例如:
ps:我想返回一个开头没有退出的表
create function xxx() returns table(x integer, y varchar) as
$$
begin
with tmp as (
select name,age from user
)
select age,name from tmp;
end;
$$
language 'plpgsql' volatile
不正确,因为没有返回数据
然后我尝试
create function xxx() returns table(x integer,y varchar) as
$$
return query (
begin
with tmp as (
select name,age from user
)
select age,name from tmp
);
end;
$$
language 'plpgsql' volatile
错误的原因是:
(19,'fw')
如何获得类似这样的结果
age | name
19 |