Unix Technical Forum

Re: plpgsql functions crash cvs

This is a discussion on Re: plpgsql functions crash cvs within the pgsql Bugs forums, part of the PostgreSQL category; --> Kris Jurka wrote: > > eKol in #postgresql reported a problem with a plpgsql function crashing > the server. ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 09:47 AM
Alvaro Herrera
 
Posts: n/a
Default Re: plpgsql functions crash cvs

Kris Jurka wrote:
>
> eKol in #postgresql reported a problem with a plpgsql function crashing
> the server. I tested the attached against 8.2cvs as of this morning
> and got this stacktrace:


Interesting. 8.1 also crashes. 8.0 instead gives this output:

psql:/home/alvherre/funcs.sql:86: ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "fn_revoke_all_functions_from"
SQL statement "SELECT admin.fn_revoke_all_functions_from( $1 , $2 )"
PL/pgSQL function "fn_revoke_all" line 11 at perform
psql:/home/alvherre/funcs.sql:88: ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "fn_revoke_all_functions_from"
SQL statement "SELECT admin.fn_revoke_all_functions_from( $1 , $2 )"
PL/pgSQL function "fn_revoke_all" line 11 at perform
psql:/home/alvherre/funcs.sql:89: ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "fn_revoke_all_functions_from"
SQL statement "SELECT admin.fn_revoke_all_functions_from( $1 , $2 )"
PL/pgSQL function "fn_revoke_all" line 11 at perform
psql:/home/alvherre/funcs.sql:90: ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "fn_revoke_all_functions_from"
SQL statement "SELECT admin.fn_revoke_all_functions_from( $1 , $2 )"
PL/pgSQL function "fn_revoke_all" line 11 at perform



In 8.1, the backtrace reads thus:

(gdb) bt
#0 plpgsql_xact_cb (event=XACT_EVENT_COMMIT, arg=0x0)
at /pgsql/source/81_rel/src/pl/plpgsql/src/pl_exec.c:4525
#1 0x080b37ed in CallXactCallbacks (event=XACT_EVENT_COMMIT)
at /pgsql/source/81_rel/src/backend/access/transam/xact.c:2618
#2 0x080b5923 in CommitTransaction ()
at /pgsql/source/81_rel/src/backend/access/transam/xact.c:1534
#3 0x080b73d9 in CommitTransactionCommand ()
at /pgsql/source/81_rel/src/backend/access/transam/xact.c:2184
#4 0x081e2d8d in finish_xact_command ()
at /pgsql/source/81_rel/src/backend/tcop/postgres.c:2006
#5 0x081e40c5 in exec_simple_query (
query_string=0x83d011c "SELECT admin.fn_revoke_all('public');")
at /pgsql/source/81_rel/src/backend/tcop/postgres.c:1032
#6 0x081e593d in PostgresMain (argc=4, argv=0x8372898,
username=0x8372860 "alvherre")
at /pgsql/source/81_rel/src/backend/tcop/postgres.c:3217
#7 0x081b771a in ServerLoop ()
at /pgsql/source/81_rel/src/backend/postmaster/postmaster.c:2853
#8 0x081b88d4 in PostmasterMain (argc=1, argv=0x8371860)
at /pgsql/source/81_rel/src/backend/postmaster/postmaster.c:941
#9 0x081753c9 in main (argc=1, argv=0x8371860)
at /pgsql/source/81_rel/src/backend/main/main.c:265
(gdb) info locals
expr = (PLpgSQL_expr *) 0x7f7f7f7f
enext = <value optimized out>


So the problem seems to be that the context containing the PLpgSQL_expr
was reset too early. I'll investigate more after dinner, if somebody
doesn't beat me to it.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com