Unix Technical Forum

BUG #2447: backend crashes when plpgsql functions are used in rules

This is a discussion on BUG #2447: backend crashes when plpgsql functions are used in rules within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2447 Logged by: michael crozier Email address: crozierm@conducivetech.com PostgreSQL version: ...


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, 10:00 AM
michael crozier
 
Posts: n/a
Default BUG #2447: backend crashes when plpgsql functions are used in rules


The following bug has been logged online:

Bug reference: 2447
Logged by: michael crozier
Email address: crozierm@conducivetech.com
PostgreSQL version: 8.0.7 & 8.0.3
Operating system: solaris 10 and linux
Description: backend crashes when plpgsql functions are used in rules
Details:

Using a function invocation in the WHERE expression of a RULE causes the
backend to crash.

I could not reproduce the problem on 8.1-beta4/Linux, but could reproduce it
on 8.0.5/Solaris, 8.0.7/Solaris, and 8.0.3/Linux.

Here is an example that can cause the crash:


CREATE TABLE parent ( id integer primary key);

CREATE OR REPLACE FUNCTION rule_condition(parent_row parent )
RETURNS INTEGER AS
$$
BEGIN
RETURN 0;
END;
$$ LANGUAGE 'plpgsql';

CREATE OR REPLACE RULE parent_rule AS
ON INSERT TO parent
WHERE 0=rule_condition(NEW)
DO INSTEAD ();

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:00 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2447: backend crashes when plpgsql functions are used in rules

"michael crozier" <crozierm@conducivetech.com> writes:
> Using a function invocation in the WHERE expression of a RULE causes the
> backend to crash.


It's not the function, it's the whole-row Var (ie, unqualified "NEW")
that doesn't work. Whole-row Vars in rules never worked at all before
8.0, and evidently they don't work in all contexts in 8.0 either :-(.

It's unlikely we'll try to make this actually work in 8.0, but I'll
look into erroring out cleanly instead of crashing. Unfortunately
it's too late for 8.0.8 :-(

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

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 09:50 PM.


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