更新时间:2023-11-22 13:23:52
作为避免此问题的一种解决方法?运算符,您可以创建新运算符进行完全相同的操作.
As a workaround to avoid the ? operator, you could create a new operator doing exactly the same.
这是原始运算符的代码:
This is the code of the original operator:
CREATE OPERATOR ?(
PROCEDURE = jsonb_exists,
LEFTARG = jsonb,
RIGHTARG = text,
RESTRICT = contsel,
JOIN = contjoinsel);
SELECT '{"a":1, "b":2}'::jsonb ? 'b'; -- true
使用没有任何冲突的其他名称(例如#-#)并创建一个新名称:
Use a different name, without any conflicts, like #-# and create a new one:
CREATE OPERATOR #-#(
PROCEDURE = jsonb_exists,
LEFTARG = jsonb,
RIGHTARG = text,
RESTRICT = contsel,
JOIN = contjoinsel);
SELECT '{"a":1, "b":2}'::jsonb #-# 'b'; -- true
在您的代码中使用此新运算符,它应该可以工作.
Use this new operator in your code and it should work.
对于所有使用?的运算符,请检查pgAdmin-> pg_catalog->运算符.的名字.
Check pgAdmin -> pg_catalog -> Operators for all the operators that use a ? in the name.