Skip site navigation (1) Skip section navigation (2)

Re: Bug #510: conditional rules sometimes work more than

From: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #510: conditional rules sometimes work more than
Date: 2001-11-06 21:35:17
Message-ID: Pine.LNX.4.21.0111062234070.23134-100000@pc10.radnoti-szeged.sulinet.hu (view raw or flat)
Thread:
Lists: pgsql-bugs
> I suspect you are assuming that
>         WHERE not szalllev_szamla_szamla_kapcs(new.szamla,new.tetelszam)
> will be executed only after the constraints in your UPDATE'S WHERE
> clause, but the planner just sees them all as a big heap of constraints,
> and executes them in whatever order it thinks will be efficient.

I see. Yes, I thought that the constraints in my UPDATE's WHERE clause are
executed first, and then the WHERE clause in the RULE. As I can understand
you, there is no way for me to force the planner to make the order of the
execution of these constraints: these constraints are completely coequal.

Presumably the base of the PostgreSQL engine doesn't support (and probably
will never support) hierarchy in constraints. I quickly read the
documentation about this (at RULEs versus TRIGGERs) but I hadn't found
anything. So probably it would be good to write some words about this. It
also would be good to include your note about the conditional RULEs (i.e.
all possibilities must be covered).

> If you are building a design in which such functions might have
> side-effects, then you'd better reconsider your design.

Well, first I wanted to write triggers but this seemed to be easier.
I will try to give a last chance to the rules and if it is not
successful, I will go back to the triggers... :-)

Thank you for your help. Your quick and deep explanations make me
PostgreSQL the most useful database server in the world.
Congratulations for the excellent work of the PostgreSQL team! ;-)

Zoltan



pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-11-07 18:27:43
Subject: Bug #511: multiple foreign keys on same table fail update cascade
Previous:From: Tom LaneDate: 2001-11-06 19:38:55
Subject: Re: Bug #510: conditional rules sometimes work more than once

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group