| От | Richard Huxton |
|---|---|
| Тема | Re: currval() within one statement |
| Дата | |
| Msg-id | 4795DF27.5030602@archonet.com обсуждение исходный текст |
| Ответ на | Re: currval() within one statement (silly_sad <sad@bankir.ru>) |
| Список | pgsql-sql |
silly_sad wrote: > > id default value is always set by the trigger before insert on each > table for each row. > > The particular subproblem is to > insert one record into ttt1 > and then insert corresponding record into ttt, > ___This is the place to use currval. I'd be tempted to turn it the other way around and have an AFTER trigger that just uses NEW.id as the value to put into "ttt". The reason to use an AFTER trigger is that you know the value can't be changed at that point, whereas with a BEFORE trigger it might. In your case it doesn't matter, but it's probably a good idea to be consistent in these things. -- Richard Huxton Archonet Ltd
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера