PostgreSQL 9.3 operator <> 没有给出逻辑结果

PostgreSQL 9.3 operator <> doesn't give logical result

我在触发器中有这段代码:

CREATE TRIGGER customernametrig
  AFTER UPDATE
  ON customers
  FOR EACH ROW
  EXECUTE PROCEDURE  trig();

和函数:

CREATE OR REPLACE FUNCTION trig()
  RETURNS trigger AS
$BODY$
begin
   if TG_OP='UPDATE' then
    RAISE NOTICE '%', new.customername;
    RAISE NOTICE '%', old.customername;
    RAISE NOTICE '%', new.customername<>old.customername;
    if new.customername<>old.customername then
        RAISE NOTICE 'hi';
    end if;
  end if;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE

customername 列的类型为 citext。

当我运行更新命令时

Update customers set customername='Jack' where customerid=125;  

它打印的字段:

NOTICE:  Jack
NOTICE:  jack
NOTICE:  f

但是如果我 运行 select 'jack'<>'Jack' 它会给我:t

所以我希望它打印的是:

NOTICE:  Jack
NOTICE:  jack
NOTICE:  t
NOTICE:  hi

我不明白这种行为。这里发生了什么?

https://www.postgresql.org/docs/current/static/citext.html

The citext module provides a case-insensitive character string type

...

citext performs comparisons by converting each string to lower case (as though lower were called) and then comparing the results normally. Thus, for example, two strings are considered equal if lower would produce identical results for them.

t=# select 'jack'<>'Jack';
 ?column? 
----------
 t
(1 row)

t=# select 'jack'::citext<>'Jack';
 ?column? 
----------
 f
(1 row)