[英]PostgreSQL: operator does not exist: timestamp without time zone == timestamp without time zone
I have created below trigger and function for update on function where I want to exclude trigger execution when there are update on two columns 'frm' and 'upto' which are of type "timestamp without time zone" 我在触发器和函数下面创建了函数更新,当两个列“ frm”和“ upto”的更新类型为“无时区的时间戳”时,我想排除触发器执行
In trigger function I am checking for updates on these two columns 在触发功能中,我正在检查这两列的更新
CREATE OR REPLACE FUNCTION ff() RETURNS TRIGGER AS $$
BEGIN
if((old."frm" == New."frm") and (old."upto" == New."upto") ) then
insert into TG_TABLE_NAME (select * from inserted );
New."from" := old."from";
NEW."upto" := current_timestamp;
RETURN NEW;
END IF;
RETURN NULL;
END $$ LANGUAGE plpgsql;
create trigger update_trig2 after update on dd
for each row execute procedure ff();`
After running update query i am getting below error in postgreSQL 运行更新查询后,我在PostgreSQL以下错误
ERROR: operator does not exist: timestamp without time zone == timestamp without time zone 错误:运算符不存在:没有时区的时间戳==没有时区的时间戳
The comparison operator is =
in SQL and PL/pgSQL. 在SQL和PL / pgSQL中,比较运算符为=
。
So you need to replace ==
with =
因此,您需要将==
替换为=
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.