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"
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
ERROR: operator does not exist: timestamp without time zone == timestamp without time zone
'='
, not'=='
. – wildplasserplsql
language initially designed by Oracle based onAda
language which based onPascal
language. So as you can see the assignment operator is:=
and the equality operator is=
(however the inequality operator could be both<>
and!=
) – Abelisto