pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedplpgsql cursors : dynamic or static?
3+ messages / 3 participants
[nested] [flat]
* plpgsql cursors : dynamic or static?
@ 2002-10-23 17:21 Ludwig Lim <lud_nowhere_man@yahoo.com>
2002-10-23 18:21 ` Re: plpgsql cursors : dynamic or static? Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ludwig Lim @ 2002-10-23 17:21 UTC (permalink / raw)
To: pgsql-sql
Hi:
Are cursors in plpgsql dynamic or static?
For example :
... /* some code */
FOR rec in SELECT f1,f2
FROM table1 WHERE .... LOOP
/* some codes that manipulate table1 */
END LOOP;
Do the result set pointed to by the cursor remains
the same even if performed some data manipulation
inside the FOR..LOOP?
Thank you in advance,
ludwig.
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: plpgsql cursors : dynamic or static?
2002-10-23 17:21 plpgsql cursors : dynamic or static? Ludwig Lim <lud_nowhere_man@yahoo.com>
@ 2002-10-23 18:21 ` Josh Berkus <josh@agliodbs.com>
2002-10-23 18:56 ` Re: plpgsql cursors : dynamic or static? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Josh Berkus @ 2002-10-23 18:21 UTC (permalink / raw)
To: Ludwig Lim <lud_nowhere_man@yahoo.com>; pgsql-sql
Ludwig,
> Are cursors in plpgsql dynamic or static?
>
> For example :
>
> ... /* some code */
> FOR rec in SELECT f1,f2
> FROM table1 WHERE .... LOOP
>
> /* some codes that manipulate table1 */
> END LOOP;
Technically speaking, that is not a cursor, even though it serves the same
purpose.
I'm pretty sure it's static, but it would be easy to test ... why don't you
give it a try?
--
-Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: plpgsql cursors : dynamic or static?
2002-10-23 17:21 plpgsql cursors : dynamic or static? Ludwig Lim <lud_nowhere_man@yahoo.com>
2002-10-23 18:21 ` Re: plpgsql cursors : dynamic or static? Josh Berkus <josh@agliodbs.com>
@ 2002-10-23 18:56 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2002-10-23 18:56 UTC (permalink / raw)
To: josh@agliodbs.com; +Cc: Ludwig Lim <lud_nowhere_man@yahoo.com>; pgsql-sql
Josh Berkus <josh@agliodbs.com> writes:
>> Are cursors in plpgsql dynamic or static?
>>
>> FOR rec in SELECT f1,f2
>> FROM table1 WHERE .... LOOP
>>
>> /* some codes that manipulate table1 */
>> END LOOP;
> Technically speaking, that is not a cursor, even though it serves the same
> purpose.
> I'm pretty sure it's static, but it would be easy to test ... why don't you
> give it a try?
The result definitely will be static in 7.3. I'm not entirely sure
about prior releases: we used to manipulate the current-command counter
in a different way.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-10-23 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-23 17:21 plpgsql cursors : dynamic or static? Ludwig Lim <lud_nowhere_man@yahoo.com>
2002-10-23 18:21 ` Josh Berkus <josh@agliodbs.com>
2002-10-23 18:56 ` Tom Lane <tgl@sss.pgh.pa.us>
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