匿名用户numeric=boolean 报错,无法进行转换
V8R6 版本下,无法实现boolean 与 numeric 之间的互转。
具体问题如下:
|
test=#
create or replace function sys_catalog.bool_eq_numeric(bool, numeric) returns
bool as $$ select $1::numeric = $2; $$ language sql; CREATE
FUNCTION test=#
create operator sys_catalog.= (procedure = bool_eq_numeric,leftarg =
bool,rightarg = numeric,commutator = =); CREATE
OPERATOR test=#
test=#
create or replace function sys_catalog.numeric_eq_bool(numeric, bool) returns
bool as $$ select $1 = $2::numeric; $$ language sql; CREATE
FUNCTION test=#
create operator sys_catalog.= (procedure = numeric_eq_bool,leftarg =
numeric,rightarg = bool,commutator = =); CREATE
OPERATOR test=#
select 1::numeric=1::int; ERROR: operator is not unique: numeric = integer LINE
1: select 1::numeric=1::int; ^ HINT: Could not choose a best candidate operator.
You might need to add explicit type casts. |
评论
有用 0
墨值悬赏

