Re: Problem with inserting into a triggerable table; - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Problem with inserting into a triggerable table;
Date
Msg-id 20040326145352.M77876@megazone.bigpanda.com
Whole thread Raw
In response to Problem with inserting into a triggerable table;  (Anoop Rajendra <axr3845@omega.uta.edu>)
List pgsql-general
On Thu, 25 Mar 2004, Anoop Rajendra wrote:

> Hi, I was having some problems with inserting into a table with a trigger
> function attached.
>
> My code is shown below -
> CREATE OR REPLACE FUNCTION update_tv_prefs() RETURNS trigger AS '
> BEGIN
>         SELECT * FROM tvprefs WHERE ch_number = NEW.id AND time_of_day =
> get_time() as X;

This "as X" is invalid I believe.

> Here, I dont have problems creating either the trigger or the function.
> Nor did I have any problems with the language before. I wrote another
> function with pretty much the same syntax ( not a trigger function though)
> and I didnt get any errors.
> But when I try to insert into the TV table, I get a error telling me -
>
> ERROR:  syntax error at or near "as" at character 76
> CONTEXT:  PL/pgSQL function "update_tv_prefs" line 2 at SQL statement

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Native Win32 port - PLEASE!
Next
From: Steve Crawford
Date:
Subject: Re: pg_dump "what if?"