|
Postgres and recursion: msg#00278db.postgresql.novice
Hi all How well does postgres handle recursion? I've got this simple function which climbs up a 'selfjoin' tree called job, and reports back the id of the root of the tree. It seemed to work in 7.2 (which I'm told doesn't recurse???), but I've just upgraded to 7.3.2 (i.e debians latest) and when I execute it, the server kicks me off, like so: vmspj=# select fx_root_job(2); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. !# Should I abandon this approach altogether? Thanks Glenn -------------- create or replace function fx_root_job(int4) returns int4 as ' declare x int4; returnvalue int4; begin select into x id_parent_ from job where id_ = $1; if x = $1 or x = 0 then returnvalue = $1; else returnvalue = fx_root_job( x ); end if; return returnvalue; end;' language 'plpgsql'; ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: pq_flush: send() failed: Broken pipe: 00278, Chad Thompson |
|---|---|
| Next by Date: | Re: Postgres and recursion: 00278, Tom Lane |
| Previous by Thread: | creating a createuserfunction.i: 00278, Michael Weaver |
| Next by Thread: | Re: Postgres and recursion: 00278, Tom Lane |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |