do delete/insert instead of update if name changes
От | amy cheng |
---|---|
Тема | do delete/insert instead of update if name changes |
Дата | |
Msg-id | 19990831160114.25350.qmail@hotmail.com обсуждение исходный текст |
Список | pgsql-general |
hi, all experts there, I'm studying the example in postgresql-6.5.1/src/pl/plpgsql/test. I do not understand why we need "do delete/insert instead of update if name changes". Is it ONLY for the test, or, there is some reason for doing that in practical use? I cut/paste part of it below. Thanks !!!!! amy ######################################## -- ************************************************************ -- * BEFORE UPDATE on PHone -- * - do delete/insert instead of update if name changes -- ************************************************************ create function tg_phone_bu() returns opaque as ' begin if new.slotname != old.slotname then delete from PHone where slotname = old.slotname; insert into PHone ( slotname, comment, slotlink ) values ( new.slotname, new.comment, new.slotlink ); return null; end if; return new; end; ' language 'plpgsql'; ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
В списке pgsql-general по дате отправления: