Re: Trigger not working as expected, first row gets a null value

Поиск
Список
Период
Сортировка
От novnov
Тема Re: Trigger not working as expected, first row gets a null value
Дата
Msg-id 12154927.post@talk.nabble.com
обсуждение исходный текст
Ответ на Re: Trigger not working as expected, first row gets a null value  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Trigger not working as expected, first row gets a null value
Список pgsql-general
I have been able to spend some more time working on this and have made a bit
of progress.

I had the trigger set to run before insert; and the sql inside the trigger
needed to ref the new record in order to supply a value. I think that's why
the first try always applied a null value.

So I've changed the trigger to go after insert. Now, all of my trigger
function variables are populated properly but the record is never updated.
The function is meant to find a value via the internal sql, and then update
a column in the same tabled that invoked the trigger with that value. Is
that a non-workable scenario? IE, an after insert trigger can't modify a
column in the same table that was updated?


Martijn van Oosterhout wrote:
>
> On Wed, Aug 08, 2007 at 03:20:00PM -0700, novnov wrote:
>>
>> I know that would be best but it'd be a major undertaking to try to repro
>> this situation. I was hoping for some hints, 'it sounds like xyz',
>> because
>> I'm pretty sure I'm just tripping over a commonplace issue.
>
> It doesn't have to be repoducable, but the definition of the tables
> involves + the code of the trigger would help. I read your description
> three times and still couldn't quite work out exactly what the problem
> was or what you were expecting to happen...
>
> Have a nice day,
> --
> Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
>> From each according to his ability. To each according to his ability to
>> litigate.
>
>
>

--
View this message in context:
http://www.nabble.com/Trigger-not-working-as-expected%2C-first-row-gets-a-null-value-tf4238812.html#a12154927
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: more select-for-update questions
Следующее
От: "Trevor Talbot"
Дата:
Сообщение: Re: Moving to postgresql and some ignorant questions