Re: trigger impacting insertion of records

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: trigger impacting insertion of records
Дата
Msg-id CAHOFxGpnMbwyzUTL5BBQYwC5rgdCFztYJojS4V8Aa0ovaK=3bw@mail.gmail.com
обсуждение исходный текст
Ответ на trigger impacting insertion of records  (Atul Kumar <akumar14871@gmail.com>)
Список pgsql-general
It seems like there is some flaw here. From my reading, on insert of any row, you are updating ALL rows in the same table to just remove an underscore if it matches the pattern of 'US_' at the beginning. That doesn't seem likely to be what you want. I'd think you would want something like the below.

CREATE OR REPLACE FUNCTION bonzipay.ussf_accountnumber_update()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$ BEGIN
if( left(NEW.accountnumber,3) = 'US_' ) then
NEW.accountnumber=replace(accountnumber,'_',' ');
RETURN NEW; END; $function$

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Nolan
Дата:
Сообщение: Re: Copyright vs Licence
Следующее
От: Jonathan Chen
Дата:
Сообщение: Postgresql 13 query engine regression