Re: a trigger question

From: "Zhou, Lixin" <LZhou(at)illumina(dot)com>
To: 'Jan Wieck' <janwieck(at)yahoo(dot)com>
Cc: 'Stephan Szabo' <sszabo(at)megazone23(dot)bigpanda(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: a trigger question
Date: 2002-06-06 19:07:31
Message-ID: 6EDF654BC7BFE648AB2E734727E7078DAEC77B@illumina24.illumina.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Jan!

>> 1) Fire the trigger AFTER INSERT. BEFORE INSERT won't work.
>> 2) Deferrable does not seem to be important.

>Jan 1) Fire the trigger BEFORE INSERT does work
>Jan 2) If you make the constraint deferred
>Jan 3) And let the trigger return NEW instead of NULL;

This is a really interesting trick!

>> I've tested above, it does work as expected for PK/FKs that are integers.

>Jan It also works for all other types of keys.

Yes, it should as I pointed out in another email.

I had troubles because I used quot_literal on a new.varchar value within the
PLPGSQL function. This should cause SQL syntax error (eg: insert into
tbl(a_string) values (''this is a string to be inserted but it will fail to
insert.'') but I got the error message as "referential integrity error"
instead of SQL syntax error.

Thanks again, Jan! I learnt a lot.

Lixin Zhou

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua b. Jore 2002-06-06 19:30:38 Re: How do I install Postgre on Windows NT?
Previous Message Nigel J. Andrews 2002-06-06 19:04:29 Re: a trigger question