strange problem with plpgsql

From: Richard NAGY <richard(at)presenceweb(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: strange problem with plpgsql
Date: 2001-12-21 09:55:28
Message-ID: 3C230710.BD7AD6A8@presenceweb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

hello,

I have a strange problem with a plpgsql function. Here is the code :

create function tg_survey_au() returns opaque as '
begin
if new.dateexpire != old.dateexpire or new.email != old.email
then
insert into survey_log values (
current_timestamp,
''update'',
new.idxsurvey,
new.dateexpire,
new.email
);
end if;
return new;
end;
' language 'plpgsql';

create trigger tg_survey_au after update on survey for each row
execute procedure tg_survey_au();

The problem is about the 'or' in the if statement. I have tested the if
statement with just one condition. One with dateexpire and one with
email. It works very well. Then I have joined the two conditions in the
if statement with an 'or' like here in the code. Then, I have an insert
in survey_log just when the email change, not if the dateexpire change!
It seems that the 'or' does not work.

Any idea ?

Note : The tests have been tested on a postgresql version 7.0.2 on a
RedHat Linux 6.2 machine.

--
Richard NAGY
Presenceweb / Nameshield

Browse pgsql-admin by date

  From Date Subject
Next Message Jules Alberts 2001-12-27 09:25:47 Re: Database alternate locations
Previous Message Bill Cunningham 2001-12-21 05:20:56 Re: Odd behavior with NULL value

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Panov 2001-12-21 12:47:36 Re: indices usage
Previous Message Karel Zak 2001-12-21 09:09:08 Re: localization