From: Walter McGinnis <pg@mars-hq.com>
To: pgsql-sql@postgresql.org
Subject: pesky plpgsql
Date: Tue, 1 Apr 2003 20:37:03 -0800
Message-ID: <C09D3F30-64C4-11D7-AEDC-00306571D2C4@mars-hq.com> (raw)
Guess I'm an April Fool. When I define the following psql returns
"CREATE":
-- update all galleries that are categories with their skey and rkey
values
CREATE FUNCTION update_cat_keys() RETURNS integer AS '
declare
v_row RECORD;
begin
for v_row in select gallery_id,
imagedb_gallery_hierarchy_skey(gallery_id, NULL, '''') as skey,
imagedb_gallery_hierarchy_rskey(gallery_id, NULL, '''') as rskey from
imagedb_galleries where category_p = ''t'' loop
update imagedb_galleries
set skey = v_row.skey, rskey = v_row.rskey
where gallery_id = v_row.gallery_id;
end loop;
return 1;
end;
' LANGUAGE 'plpgsql';
When I call the function I get the following error:
devpps=# select update_cat_keys();
NOTICE: plpgsql: ERROR during compile of update_cat_keys near line 2
ERROR: parse error at or near ";"
The select in the loop runs fine in psql. So I'm stumped...
I'm pretty ignorant about plpgsql, I'm used to pl/sql.
TIA,
Walter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: pg@mars-hq.com
Subject: Re: pesky plpgsql
In-Reply-To: <C09D3F30-64C4-11D7-AEDC-00306571D2C4@mars-hq.com>
References: <C09D3F30-64C4-11D7-AEDC-00306571D2C4@mars-hq.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox