我试着在PostgreSQL 10中运行这个查询:
select e.errordescription,
CASE
WHEN e.reworkempid is not null THEN get_empname(e.reworkempid)
else null
end
from error_log_gs e
where e.qcworkpackageid=3012175 and e.logno=1
字符串
得到错误:
CASE中不允许使用集返回函数
我试着在PostgreSQL 10中运行这个查询:
select e.errordescription,
CASE
WHEN e.reworkempid is not null THEN get_empname(e.reworkempid)
else null
end
from error_log_gs e
where e.qcworkpackageid=3012175 and e.logno=1
字符串
得到错误:
CASE中不允许使用集返回函数
2条答案
按热度按时间tjrkku2a1#
使用
lateral join
代替:字符串
kqqjbcuj2#
我遇到的确切错误是,0A000:在CASE中不允许设置返回函数。
在调查时,发现该语法在Postgres 9.6版中有效,但在11版中无效。
为了克服这个问题,我又添加了一个CTE(公共表表达式),如下所示,解决了我的问题。
字符串