标签: chartio

postgreSQL 中的 CASE 不允许使用返回集合的函数

我正在尝试运行此查询,直到不久前才能够运行。我不知道出了什么问题,我现在开始收到此错误?

Your database returned: ERROR: set-returning functions are not allowed in CASE Hint: You might be able to move the set-returning function into a LATERAL FROM item.

我的查询:

SELECT distinct
(CASE
WHEN {PERIOD} = 'Previous Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date AND pto.pto_end_date >= (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date
THEN generate_series(pto.pto_start_date, pto.pto_end_date, '2 day'::interval)
WHEN {PERIOD} = 'Current Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 …
Run Code Online (Sandbox Code Playgroud)

sql postgresql sql-function generate-series chartio

4
推荐指数
1
解决办法
7047
查看次数

标签 统计

chartio ×1

generate-series ×1

postgresql ×1

sql ×1

sql-function ×1