Re: Trigger problem

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Trigger problem
Дата
Msg-id 200112071805.fB7I5h402111@saturn.jw.home
обсуждение исходный текст
Ответ на Re: Trigger problem  (mordicus <mordicus@free.fr>)
Список pgsql-general
mordicus wrote:
> Stephan Szabo wrote:
>
> > On Thu, 6 Dec 2001, mordicus wrote:
> >
> >> So, if i do
> >>
> >> insert into abreviations(smot,mot,abreviation,pays) select
> >> smot,mot,abreviation,pays from a;
> >>
> >> the Trigger is executed for each row ONLY after all rows have been
> >> inserted, so the
> >> "   id    := currval(''abr_id'');"
> >> in my trigger have false value (always the last value after 53000 insert
> >> ...)
> >
> > Wouldn't NEW.id give you the value you want rather than mucking with the
> > sequence value?
> >
>
> hum, not tested but i don't think because nextval('abr_id') is the default
> value of id.

    So what value do you want to have? If it is the value the NEW
    row has gotten when  it  was  inserted,  you'll  find  it  in
    NEW.id.  The  trigger  call  mechanism  doesn't know any more
    where that  value  was  coming  from,  it  simply  pulls  the
    inserted row and fires the trigger.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Предыдущее
От: Ken
Дата:
Сообщение: Re: Errors: Too many open files
Следующее
От: Andrew Gould
Дата:
Сообщение: Re: When do I Vacuum ?