[prev in list] [next in list] [prev in thread] [next in thread]
List: pgsql-bugs
Subject: [BUGS] Rules not executed on child tables
From: <depstein () alliedtesting ! com>
Date: 2010-08-18 9:36:07
Message-ID: 29F36C7C98AB09499B1A209D48EAA615B4EBB2D72D () mail2a ! alliedtesting ! com
[Download RAW message or body]
Hi,
I noticed that when an action is executed on a parent table, rules for that=
action that are defined on its child tables are ignored.
Example:
create table A (ind integer);
create table B () inherits (A);
CREATE OR REPLACE RULE B_delete_rule AS
ON DELETE TO B DO INSTEAD NOTHING;
insert into B values(0);
delete from B;
-- Query returned successfully: 0 rows affected, 0 ms execution time.
-- This is what I expected
delete from A;
-- Query returned successfully: 1 row affected, 0 ms execution time.
-- This is NOT what I expected!
I am using PostgreSQL 8.4.1 on Windows XP Pro
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:8.5in 11.0in;
margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hi,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I noticed that when an action is executed on a parent table,
rules for that action that are defined on its child tables are \
ignored.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Example:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'>create table A (ind \
integer);<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'>create table B () inherits \
(A);<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'>CREATE OR REPLACE RULE
B_delete_rule AS<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'> ON DELETE TO B
DO INSTEAD NOTHING;<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'>insert into B values(0);<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'>delete from B;<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'>-- Query returned successfully: 0
rows affected, 0 ms execution time.<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'>-- This is what I expected<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoNormal style='margin-left:.5in'>delete from A;<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'>-- Query returned successfully: 1
row affected, 0 ms execution time.<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in'>-- This is NOT what I \
expected!<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I am using PostgreSQL 8.4.1 on Windows XP Pro<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic