PL/PGSQL: why IF test the whole condition before failing or not?
В списке pgsql-general по дате отправления:
| От | Suporte PK |
|---|---|
| Тема | PL/PGSQL: why IF test the whole condition before failing or not? |
| Дата | |
| Msg-id | 4A8B1BDE.6000607@pksoftware.com.br обсуждение исходный текст |
| Ответы |
Re: PL/PGSQL: why IF test the whole condition before failing or not?
|
| Список | pgsql-general |
Hi list, I'm having trouble with - believe me! - the IF operator on a PL/PGSQL function used by a trigger. I'm using one unique function to process the three triggers events (delete, update and insert), but when I reference OLD or NEW on a IF CONDITION, I get an error even when testing BEFORE if it's a UPDATE event or not. example: IF TG_OP = 'UPDATE' AND OLD.field != NEW.field THEN ... END IF; The question is: if the trigger was not fired by an UPDATE event, shouldn't it make the first test and then ignore the rest of the condition? I know that some languages work like this (testing the whole condition) while others don't, but I searched for an alternative without success. Any advice would be much appreciated! Thanks in advance
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера