[GENERAL] Trigger (Transaction related)

2006-09-01 Thread Harpreet Dhaliwal
Hi,I've written a trigger after insert on a table (parser) and the trigger calls a function that dynamically loads a shared object written in C.This shared object intends to use the newly inserted row in the table on which trigger is written and insert values in another table, something like this,

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Martijn van Oosterhout
On Fri, Sep 01, 2006 at 02:51:59AM -0400, Harpreet Dhaliwal wrote: Hi, I've written a trigger after insert on a table (parser) and the trigger calls a function that dynamically loads a shared object written in C. This shared object intends to use the newly inserted row in the table on which

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Harpreet Dhaliwal
If that is the case then why does it throw error in one on the insert queries in the shared object written in SPI without inserting the row on the table on which record is inserted.Follwing query in the shared object throws an error. INSERT INTO headers (id, header_content) VALUES (1, SELECT

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-09-01 03:19:03 -0400: If that is the case then why does it throw error in one on the insert queries in the shared object written in SPI without inserting the row on the table on which record is inserted. Follwing query in the shared object throws an error.

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Harpreet Dhaliwal
Thats OK, but my question is why did the original insert not take place. Syntax error was in the select query that is fired as a result of the triggerThanks,~Harpreet On 9/1/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-09-01 03:19:03 -0400: If that is the case then why

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Martijn van Oosterhout
On Fri, Sep 01, 2006 at 03:33:55AM -0400, Harpreet Dhaliwal wrote: Thats OK, but my question is why did the original insert not take place. Syntax error was in the select query that is fired as a result of the trigger The trigger is part of the transaction. If the trigger fails, so does the

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Tom Lane
Harpreet Dhaliwal [EMAIL PROTECTED] writes: sprintf(buffer, INSERT INTO headers (id, header_content) VALUES ( %d, SELECT contents FROM parser WHERE id = %d ), id, id); SPI_exec(buffer,0). You're short some parentheses --- try executing a comparable query manually.

Re: [GENERAL] Trigger (Transaction related)

2006-09-01 Thread Harpreet Dhaliwal
Exactly Tom,I was missing a few paranthesis like a nut.Thanks for pointing out.Thanks and regards~HarpreetOn 9/1/06, Tom Lane [EMAIL PROTECTED] wrote:Harpreet Dhaliwal [EMAIL PROTECTED] writes: sprintf(buffer, INSERT INTO headers (id, header_content) VALUES ( %d, SELECT contents FROM parser