> select count(*) into cnt from <tablename> where new.<key> = key;
> if (cnt>0) then
> delete from <tablename> where key = new.<key>
> end if
Just looked at this, and this is not actually what you wanted. If you do
not want to replace the old row, do something along the lines
RAISE EXCEPTION ''Duplicate entry''
which will abort the insert. It's all in the manual.
In response to
pgsql-general by date
|Next:||From: Statistical Solutions||Date: 1999-04-26 13:51:24|
|Subject: Re: [GENERAL] advice on buying sun hardware to run postgres|
|Previous:||From: Adriaan Joubert||Date: 1999-04-26 13:22:08|
|Subject: Re: [GENERAL] Trigger or Rule?|