Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   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.


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux