为什么 RAISE NOTICE 在 Redshift 中不起作用?

Why is RAISE NOTICE not working in Redshift?

我尝试运行在控制台的 Redshift 查询编辑器中执行以下命令:

RAISE NOTICE 'hello world';

报错:

ERROR: syntax error at or near "RAISE" Position: 1

我已经尝试了大写和小写的命令,并且还尝试了从 DBeaver 中 运行ning 它以防控制台本身出现问题。我也试过它作为 RAISE INFO。 None 其中成功。我拥有集群的管理员权限,并且能够成功执行 运行 其他命令。可能是什么原因造成的?

它也是 AWS Redshift stored procedures 中使用的 PL/pgSQL 程序语言的一部分。因此,您只能在存储过程中使用它

您可以关注basic example

CREATE PROCEDURE update_value() AS $$
DECLARE
  value integer := 20;
BEGIN
  RAISE NOTICE 'Value here is %', value;  -- Value here is 20
  value := 50;
  --
  -- Create a subblock
  --
  DECLARE
    value integer := 80;
  BEGIN
    RAISE NOTICE 'Value here is %', value;  -- Value here is 80
  END;

  RAISE NOTICE 'Value here is %', value;  -- Value here is 50
END;
$$ LANGUAGE plpgsql;  

和运行它与

call update_value();