Re: Trigger (Transaction related)

From: "Harpreet Dhaliwal" <harpreet(dot)dhaliwal01(at)gmail(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger (Transaction related)
Date: 2006-09-01 07:33:55
Message-ID: d86a77ef0609010033v505fee96l75d3a6718e9cd846@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Thanks,
~Harpreet

On 9/1/06, Roman Neuhauser <neuhauser(at)sigpipe(dot)cz> wrote:
>
> # harpreet(dot)dhaliwal01(at)gmail(dot)com / 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.
> >
> >
> > INSERT INTO headers (id, header_content) VALUES (1, SELECT raw_email
> FROM
> > parser WHERE id = 1)
> >
> > Error is
> > ERROR: syntax error at or near "SELECT" at character 53
>
> Because there's a syntax error.
>
> test=# INSERT INTO headers (id, header_content) VALUES (1, SELECT
> raw_email FROM parser WHERE id = 1);
> ERROR: syntax error at or near "SELECT" at character 53
> LINE 1: ...SERT INTO headers (id, header_content) VALUES (1, SELECT
> raw...
> ^
> test=# INSERT INTO headers (id, header_content) VALUES (1, (SELECT
> raw_email FROM parser WHERE id = 1));
> ERROR: relation "headers" does not exist
> test=#
>
> > Regardless the error in the shared object, why doesn't it insert the
> > row in the table on which AFTER INSERT trigger is written?
>
> Perhaps you should verify the syntax of your queries in a less
> demanding environment, like psql, first.
>
> --
> How many Vietnam vets does it take to screw in a light bulb?
> You don't know, man. You don't KNOW.
> Cause you weren't THERE. http://bash.org/?255991
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Bali 2006-09-01 07:41:12 Re: SPI_execute (result of a select statement)
Previous Message Anton de Wet 2006-09-01 07:20:38 Re: Thought provoking piece on NetBSD