简体   繁体   English

PostgreSQL:运算符不存在:没有时区的时间戳==没有时区的时间戳

[英]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.

相关问题 运算符不存在:没有时区的时间戳~~ *未知的Ruby代码 - operator does not exist: timestamp without time zone ~~* unknown ruby code SQL: 函数 trunc(timestamp without time zone, "unknown") 不存在 - SQL: function trunc(timestamp without time zone, "unknown") does not exist 出现错误“功能周(没有时区的时间戳)不存在” - Getting error “function week(timestamp without time zone) does not exist” SQL 执行失败:运算符不存在:bigint >= timestamp without time zone - SQL execution failed: operator does not exist: bigint >= timestamp without time zone 如何将没有时区的时间转换为没有时区的时间戳? - How to convert time without time zone to timestamp without time zone? 相当于SQL Server中的PostgreSQL类型“没有时区的时间戳” - equivalent of PostgreSQL type “timestamp without time zone” in SQL Server postgreSQL将列数据类型更改为没有时区的时间戳 - postgreSQL alter column data type to timestamp without time zone PostgreSQL 中是否有一种本地技术可以强制“没有时区的时间戳”不包括毫秒? - Is there a native technique in PostgreSQL to force "timestamp without time zone" to not include milliseconds? 错误:函数 date_trunc(timestamp without time zone) 不存在 - ERROR: function date_trunc(timestamp without time zone) does not exist 获取错误函数to_date(没有时区的时间戳,未知)不存在 - Getting error function to_date(timestamp without time zone, unknown) does not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM