lightdb 允许常用比较操作符之前存在空格

背景

在 Oracle 中,>=, <=, !=, <> 操作符字符之间允许存在空格。为兼容这种特性,LightDB 24.1 中对这些比较操作符作了特殊处理。

用例

select count(*) from dual where 1 >  = 1;
select count(*) from dual where 1 <   =  1;
select count(*) from dual where 1 !     =   2;
select count(*) from dual where 1 <       >   1;

自定义操作符不会受到影响,

--
-- custom operator should not be affected
--{
create function strong_not_equal(int, int) returns bool as 'select $1 != $2' language sql;
create operator <>= (
  function = strong_not_equal,
  leftarg = int, rightarg = int
);
--= false
select count(*) from dual where 1 <>= 2;
--= error
select count(*) from dual where 1< >= 2;
--= error
select count(*) from dual where 1 < > = 2;
--= error
select count(*) from dual where 1  <> = 2;
--}

posted on 2024-01-22 11:43  winter-loo  阅读(5)  评论(0编辑  收藏  举报

导航