pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDeclare Cursor...
2+ messages / 2 participants
[nested] [flat]
* Declare Cursor...
@ 1999-11-08 14:32 Baris Ulu <ulu@bornova.ege.edu.tr>
0 siblings, 1 reply; 2+ messages in thread
From: Baris Ulu @ 1999-11-08 14:32 UTC (permalink / raw)
To: pgsql-sql
I am trying to declare a cursor inside a plpgsql function in a
begin end block as in the following:
create function func_1(char, float8, int4, int4) returns int4 as '
declare
x alias for $1;
y alias for $2;
z alias for $3;
t alias for $4;
...
begin work;
declare cursor_x cursor for select a, b, c, d from table_1 where a = x;
...
end work;
when this function is compiled, it gives me the following error:
NOTICE: plpgsql: ERROR during compile of func_1 near line ...
ERROR: parse error at or near "CURSOR"
If anyone can help me about my problem, I will be very happy...THANKS!
Baris ULU
Computer Engineer
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Declare Cursor...
@ 1999-11-08 17:57 Jan Wieck <wieck@debis.com>
parent: Baris Ulu <ulu@bornova.ege.edu.tr>
0 siblings, 0 replies; 2+ messages in thread
From: wieck@debis.com @ 1999-11-08 17:57 UTC (permalink / raw)
To: ulu@bornova.ege.edu.tr; +Cc: pgsql-sql; maillist@candle.pha.pa.us
Baris ULU wrote:
> I am trying to declare a cursor inside a plpgsql function in a
> begin end block as in the following:
> create function func_1(char, float8, int4, int4) returns int4 as '
> declare
> x alias for $1;
> y alias for $2;
> z alias for $3;
> t alias for $4;
> ...
> begin work;
> declare cursor_x cursor for select a, b, c, d from table_1 where a = x;
> ...
> end work;
>
> when this function is compiled, it gives me the following error:
> NOTICE: plpgsql: ERROR during compile of func_1 near line ...
> ERROR: parse error at or near "CURSOR"
>
> If anyone can help me about my problem, I will be very happy...THANKS!
Backend functions cannot use cursors. This is not supported
by the underlying mechanism of portals and the server
programming interface.
Yes, it's a very bad limitation since the SPI tries to load
the entire result set into memory, possibly blowing away the
backend process. I don't know how and when we will tackle
this, but it should go onto the TODO, Bruce.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck@debis.com (Jan Wieck) #
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-11-08 17:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-11-08 14:32 Declare Cursor... Baris Ulu <ulu@bornova.ege.edu.tr>
1999-11-08 17:57 ` Jan Wieck <wieck@debis.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