我编写了一个包含 while 语句的 PostgreSQL 函数,例如:
WHILE id_exist == 'f' LOOP
lotto_id = lotto_id + 1;
id_exist = check_if_exist(lotto_id, 'lotto', 'id');
END LOOP;
whereid_exist
是通过调用check_if_exist()
返回布尔值的方法(也在 while 代码中使用)初始化的布尔变量。
现在,当我尝试调用我的函数时,出现此错误
ERROR: operator does not exist: boolean == unknown
LINE 1: SELECT id_exist == 'f'
^
HINT: No operator matches the given name and argument type(s). You might need to add
explicit type casts.
QUERY: SELECT id_exist == 'f'
CONTEXT: PL/pgSQL function "acquistolotto" line 11 at WHILE