Re: Stored Procedure Newbie

From: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
To: Eric Chacon <chaconeric(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stored Procedure Newbie
Date: 2001-07-10 22:22:02
Message-ID: Pine.LNX.4.21.0107101820270.7168-100000@aluminum.cs.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6 Jul 2001, Eric Chacon wrote:

> I have a file with the following contents:
>
> DROP FUNCTION update_flag_func();
> CREATE FUNCTION update_flag_func()
> RETURNS text
> AS 'UPDATE update_flag SET content=current_timestamp;'
> LANGUAGE 'plpgsql';
>
> SELECT update_flag_func();
>
> When I run the 'UPDATE update_flag SET content=current_timestamp' in
> the SQL window (pgaccess), it works.
>
> When I type
> psql -f udt jags_content
>
> I get an error...
>
> DROP
> CREATE
> psql:udt:7: NOTICE: plpgsql: ERROR during compile of update_flag_func
> near line 1
> psql:udt:7: ERROR: parse error at or near "UPDATE"
>
> What obvious thing am I missing?

The way you do it, it's better you define LANGUAGE 'sql'
Plpgsql is supposed to have a BEGIN and an END surrounding the statements.

cheers,
thalis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Masto 2001-07-10 22:23:52 View prevents index
Previous Message Peter Eisentraut 2001-07-10 22:03:34 Re: Re: Too much data received?