pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6583: for loop cursor
4+ messages / 3 participants
[nested] [flat]
* BUG #6583: for loop cursor
@ 2012-04-12 08:55 biju.george@ust-global.com
2012-04-12 14:52 ` Re: BUG #6583: for loop cursor Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: biju.george@ust-global.com @ 2012-04-12 08:55 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 6583
Logged by: Biju George
Email address: biju.george@ust-global.com
PostgreSQL version: 8.4.0
Operating system: Linux
Description:
Just this simple code throws below error --
CREATE OR REPLACE FUNCTION my_temp_func(v_acc_type integer)
RETURNS void AS
$BODY$
declare
v_cur cursor (acc_num integer) is select pid from public.my_trade_table
where acc_type = acc_num;
begin
for record_var in v_cur(v_acc_type) loop
raise notice 'ID is %',record_var.id;
end loop;
end;
$BODY$
LANGUAGE plpgsql;
------------Error---------------
ERROR: syntax error at or near "$1"
LINE 1: $1 ( $2 )
^
QUERY: $1 ( $2 )
CONTEXT: SQL statement in PL/PgSQL function "my_temp_func" near line 4
********** Error **********
ERROR: syntax error at or near "$1"
SQL state: 42601
Context: SQL statement in PL/PgSQL function "my_temp_func" near line 4
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #6583: for loop cursor
2012-04-12 08:55 BUG #6583: for loop cursor biju.george@ust-global.com
@ 2012-04-12 14:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-04-12 15:04 ` Re: BUG #6583: for loop cursor Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2012-04-12 14:52 UTC (permalink / raw)
To: biju.george@ust-global.com; +Cc: pgsql-bugs
biju.george@ust-global.com writes:
> The following bug has been logged on the website:
> Bug reference: 6583
> Logged by: Biju George
> Email address: biju.george@ust-global.com
> PostgreSQL version: 8.4.0
> Operating system: Linux
> Description:
> Just this simple code throws below error --
> CREATE OR REPLACE FUNCTION my_temp_func(v_acc_type integer)
> RETURNS void AS
> $BODY$
> declare
> v_cur cursor (acc_num integer) is select pid from public.my_trade_table
> where acc_type = acc_num;
> begin
> for record_var in v_cur(v_acc_type) loop
> raise notice 'ID is %',record_var.id;
> end loop;
> end;
> $BODY$
> LANGUAGE plpgsql;
Works for me in 8.4.11 (after correcting record_var.id -> record_var.pid
at line 6). Maybe you need to update to some more recent version than
8.4.0.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #6583: for loop cursor
2012-04-12 08:55 BUG #6583: for loop cursor biju.george@ust-global.com
2012-04-12 14:52 ` Re: BUG #6583: for loop cursor Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-04-12 15:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-04-13 10:48 ` Re: BUG #6583: for loop cursor Biju George (UST, IND) <Biju.George@ust-global.com>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2012-04-12 15:04 UTC (permalink / raw)
To: biju.george@ust-global.com; +Cc: pgsql-bugs
I wrote:
> Works for me in 8.4.11 (after correcting record_var.id -> record_var.pid
> at line 6). Maybe you need to update to some more recent version than
> 8.4.0.
Actually, I do get the described behavior when trying this in 8.3,
which does not have FOR-over-cursor. So maybe the more appropriate
question is whether you're really running 8.4.anything.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #6583: for loop cursor
2012-04-12 08:55 BUG #6583: for loop cursor biju.george@ust-global.com
2012-04-12 14:52 ` Re: BUG #6583: for loop cursor Tom Lane <tgl@sss.pgh.pa.us>
2012-04-12 15:04 ` Re: BUG #6583: for loop cursor Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-04-13 10:48 ` Biju George (UST, IND) <Biju.George@ust-global.com>
0 siblings, 0 replies; 4+ messages in thread
From: Biju George (UST, IND) @ 2012-04-13 10:48 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
Hi Tom,
Well I thought I was running version "8.4.*" but it turned out to be "8.2.14" when I did a show server_version in pgAdminIII. So, is this a known issue?
Well I won't possibly be able to upgrade the version as its bundled with the DB. :-(
Cordially,
Biju George
UST Global | Trivandrum
________________________________
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Thu 4/12/2012 8:34 PM
To: Biju George (UST, IND)
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #6583: for loop cursor
I wrote:
> Works for me in 8.4.11 (after correcting record_var.id -> record_var.pid
> at line 6). Maybe you need to update to some more recent version than
> 8.4.0.
Actually, I do get the described behavior when trying this in 8.3,
which does not have FOR-over-cursor. So maybe the more appropriate
question is whether you're really running 8.4.anything.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2012-04-13 10:48 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 08:55 BUG #6583: for loop cursor biju.george@ust-global.com
2012-04-12 14:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-04-12 15:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-04-13 10:48 ` Biju George (UST, IND) <Biju.George@ust-global.com>
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