我有一个存储过程,我在其中声明了一个 UUID 数组,在使用该变量时,它会抛出强制转换异常。
create or replace function test.test_function(max integer, interval interval) returns SETOF test.test_table
language plpgsql
as
$$
DECLARE
min TIMESTAMP;
max TIMESTAMP;
array_of_guids uuid[];
BEGIN
array_of_guids = ARRAY(SELECT guid FROM test.test_table WHERE guid NOT IN (SELECT guid FROM test.ignore_test));
...
END
$$;
guid 是 UUID 类型,但在这一行,我收到一条错误消息:
[2019-09-27 12:12:48] Where: PL/pgSQL function test.test_function(integer,interval) line 10 at assignment```
Unable to figure out the syntax to fix the above problem.
将赋值运算符更改为
:=
或使用select into
db<>在这里摆弄