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