Skip site navigation (1) Skip section navigation (2)

Re: BUG #6583: for loop cursor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: biju(dot)george(at)ust-global(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6583: for loop cursor
Date: 2012-04-12 14:52:28
Message-ID: 2849.1334242348@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
biju(dot)george(at)ust-global(dot)com writes:
> The following bug has been logged on the website:
> Bug reference:      6583
> Logged by:          Biju George
> Email address:      biju(dot)george(at)ust-global(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2012-04-12 15:04:37
Subject: Re: BUG #6583: for loop cursor
Previous:From: Greg StarkDate: 2012-04-12 14:28:54
Subject: Re: BUG #6578: Deadlock in libpq after upgrading from 8.4.7 to 8.4.11

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group