Re: Problem with inserting into a triggerable table;

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Anoop Rajendra <axr3845(at)omega(dot)uta(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with inserting into a triggerable table;
Date: 2004-03-26 22:54:26
Message-ID: 20040326145352.M77876@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2004-03-26 23:12:45 Re: pg_dump "what if?"
Previous Message Jeff Eckermann 2004-03-26 22:44:05 Re: Native Win32 port - PLEASE!