Thread: PostgreSQL 7.1.1: Backend crash when calling plpgsql function
(bs@niggard.org) reports a bug with a severity of 2 The lower the number the more severe it is. Short Description PostgreSQL 7.1.1: Backend crash when calling plpgsql function Long Description Hi, while porting a 6.5 app to 7.1.1 i found a plpgsql function that crashes the backend. Other functions work though. Wheni rewrite the function to be more sane, the crash doesnt happen anymore. Still the backend shouldnt crash (and it didntin 6.5 btw). The whole db dump is about 28megs if anyone is interested. In case it matters: the 7.1.1 was installed over a 7.0.3, so maybe there is some plpgsql versioning conflict?? Thanks. Sample Code Crashing function: CREATE FUNCTION "new_news" (varchar ) RETURNS int4 AS ' DECLARE uid_p varchar; BEGIN Select l.uid into uid_p from nachrichten2 n2, luser l WHERE l.uid = $1 AND l.uid = n2.uid AND id > letzte_nachricht group by l.uid; IF uid_p ISNULL THEN RETURN 0; END IF; RETURN 1; END; ' LANGUAGE 'plpgsql'; Not crashing function: CREATE FUNCTION "new_news" (varchar ) RETURNS int4 AS ' BEGIN IF NOT EXISTS( Select l.uid from nachrichten2 n2, luser l WHERE l.uid = $1 AND l.uid = n2.uid AND id > letzte_nachricht ) THEN RETURN 0; END IF; RETURN 1; END; ' LANGUAGE 'plpgsql'; No file was uploaded with this report
This looks similar to the issue I reported. Tom has already placed a patch in CVS that works for me. fetch the latest pgsql/src/pl/plpgsql/src/pl_exec.c file from CVS in the REL7_1_STABLE branch. Going back to 7.1 also fixes this problem. On Wed, May 09, 2001 at 08:54:03AM -0400, pgsql-bugs@postgresql.org wrote: > (bs@niggard.org) reports a bug with a severity of 2 > The lower the number the more severe it is. > > Short Description > PostgreSQL 7.1.1: Backend crash when calling plpgsql function > > Long Description > Hi, while porting a 6.5 app to 7.1.1 i found a plpgsql function that crashes the backend. Other functions work though.When i rewrite the function to be more sane, the crash doesnt happen anymore. Still the backend shouldnt crash (andit didnt in 6.5 btw). > > The whole db dump is about 28megs if anyone is interested. > > In case it matters: the 7.1.1 was installed over a 7.0.3, so maybe there is some plpgsql versioning conflict?? > > Thanks. > > > Sample Code > Crashing function: > CREATE FUNCTION "new_news" (varchar ) RETURNS int4 AS ' > DECLARE > uid_p varchar; > BEGIN > Select l.uid into uid_p from nachrichten2 n2, luser l > WHERE l.uid = $1 > AND l.uid = n2.uid > AND id > letzte_nachricht > group by l.uid; > IF uid_p ISNULL THEN > RETURN 0; > END IF; > RETURN 1; > END; > ' LANGUAGE 'plpgsql'; > > Not crashing function: > CREATE FUNCTION "new_news" (varchar ) RETURNS int4 AS ' > BEGIN > IF NOT EXISTS( > Select l.uid from nachrichten2 n2, luser l > WHERE l.uid = $1 > AND l.uid = n2.uid > AND id > letzte_nachricht > ) THEN > RETURN 0; > END IF; > RETURN 1; > END; > ' LANGUAGE 'plpgsql'; > > > > No file was uploaded with this report > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
pgsql-bugs@postgresql.org writes: > Hi, while porting a 6.5 app to 7.1.1 i found a plpgsql function that > crashes the backend. Other functions work though. When i rewrite the > function to be more sane, the crash doesnt happen anymore. Still the > backend shouldnt crash (and it didnt in 6.5 btw). > The whole db dump is about 28megs if anyone is interested. I'd like to look at this, but 28meg is more than I want to download (stuck behind a dialup line for the present :-(). Would you please try to devise a small dataset that exhibits the problem, and send it along in the form of a psql script? 7.1.2 is due out at the end of the week, so the sooner you can get it to me the better ... regards, tom lane