postgresql中的函数调用不返回结果集

时间:2016-11-16 11:02:35

标签: sql postgresql plpgsql postgresql-9.4

我有像

这样的postgresql函数
create or replace function getalltypes(name character varying(100))
returns  setof docs as $BODY$ 

begin
perform c.contenttypename from conttype c;

end;
$BODY$  LANGUAGE PLPGSQL;

docs是我创建的类型

create type docs as (contenttypename character varying(100))

on

select getalltypes('') 

没有显示结果。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

你没有任何退货声明。这就是为什么你看不到结果。 PERFORM this issue 这就是为什么您应该将perform c.contenttypename from conttype c;更改为return query select c.contenttypename from conttype c;

相关问题