Why would this crash my server - Mailing list pgsql-novice

From glenn
Subject Why would this crash my server
Date
Msg-id 1046052378.3417.25.camel@thor.valhalla
Whole thread Raw
Responses Re: Why would this crash my server
List pgsql-novice
Hi all
I've been playing round for a week or so now trying to master the
elusive secrets of passing sets of records around in postgres. Having
made a little progress, I thought I'd try using cursors - I didn't get
very far, but I did bring my machine to its knees and kill the postgres
server (on the same machine). Here's what I did, I'm wondering what
needs changing:

-- Here is my table
glenn=# select * from zz;
 a | b
---+---
 1 | 0
 2 | 0
 3 | 0
 4 | 2
 5 | 2
 6 | 1
 7 | 4
 8 | 4
 9 | 7
(9 rows)

-- Here is my experimental function
create or replace function zz_dump() returns setof zz  as '
declare
        thiscur  refcursor;
        zz_tmp zz%rowtype ;
begin
        open thiscur for select a, b from zz;
        fetch thiscur into zz_tmp  ;
        return zz_tmp;
end;' language 'plpgsql';

--Heres the result, which comes after 5 min of hdd light thrashing,
capslock light doesn't respond and gui completely freezes. Interesting
thing is that after this executes, the gnome resources panel shows that
the amount of physical memory in use has halved. i.e. first time
95%->47%, 2nd time 47%->21%

thanks for _any_ help
Glenn


pgsql-novice by date:

Previous
From: Robert Prather
Date:
Subject: Re: User Problem In PostgreSQL on Mac OS X
Next
From: Michael Weaver
Date:
Subject: Substring & escape Character