【发布时间】:2015-12-01 09:40:21
【问题描述】:
我正在编写一个简单的 postgres 函数。这个函数的结果应该是“事件”表的一行。我有以下内容:
create or replace function featured_event() returns setof events as
$$
begin
select events.* from events where featured is true;
end
$$ LANGUAGE plpgsql;
我不想对列进行硬编码,而是使用现有表中的结构作为返回类型。
这不是与Function with SQL query has no destination for result data 重复,因为我不想使用table 结果类型。
【问题讨论】:
标签: postgresql plpgsql