Re: CREATE RULE ON UPDATE/DELETE

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Aasmund Midttun Godal <postgresql(at)envisity(dot)com>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, joel(at)joelburton(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: CREATE RULE ON UPDATE/DELETE
Date: 2001-11-29 22:17:39
Message-ID: 200111292217.fATMHdZ12712@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql


I have added the following text to the CREATE TRIGGER manual page to
address this issue. It often confuses people so it is good to point
out:

<para>
<command>SELECT</command> does not modify any rows so you can not
create <command>SELECT</command> triggers.
</para>

---------------------------------------------------------------------------

> Yes, I agree perfectly... I never thought of that! I would really like it if some more info was added to the docs regarding info on rules and triggers. The section on update rules is quite good, but some more would never hurt. One point in the trigger vs rules section which at least to me is very important is the simple fact that you cannot have a trigger on a select... Ok I understand why - but it took some time...
>
> Thank you for answering my questions!
>
> regards,
>
> Aasmund.
> On Sun, 21 Oct 2001 12:47:41 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Joel Burton <joel(at)joelburton(dot)com> writes:
> >
> >
> > Surely you'd need something like
> >
> > CREATE RULE dbl_update AS ON UPDATE TO dbl DO INSTEAD UPDATE raw SET
> > id = NEW.id / 2, name = NEW.name WHERE OLD.id = id * 2;
> >
> > (untested...)
> >
> > regards, tom lane
>
> Aasmund Midttun Godal
>
> aasmund(at)godal(dot)com - http://www.godal.com/
> +47 40 45 20 46
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2001-11-29 23:06:21 Re: Second call for platform testing
Previous Message Olivier PRENANT 2001-11-29 21:39:15 Re: Call for platform testing

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-11-29 23:13:05 Re: PL/pgSQL loops?
Previous Message Peter 2001-11-29 21:47:35 Database Replicatio via triggers