Re: Return of INSTEAD rules

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paesold <mpaesold(at)gmx(dot)at>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Return of INSTEAD rules
Date: 2002-10-04 16:59:28
Message-ID: 200210041659.g94GxSS20072@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manfred Koizar wrote:
> On Thu, 3 Oct 2002 22:21:27 -0400 (EDT), Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> >so I propose we handle
> >INSTEAD rules this way: that we return the oid and tuple count of the
> >last INSTEAD rule query with a tag matching the main query.
>
> Bruce, this won't work for this example
>
> >> CREATE RULE visible_delete AS -- DELETE rule
> >> ON DELETE TO visible
> >> DO INSTEAD
> >> COUNT UPDATE table3
> >> SET deleted = 1
> >> WHERE pk = old.pk;
>
> because here we don't have a rule query with a matching tag. Same
> applies for

True, but because we have said we are going to return the tag of the
original command, I don't think we have anything valid to return in this
case to match the tag.

> >> CREATE RULE v_update AS -- UPDATE rule
> >> ON UPDATE TO v
> >> DO INSTEAD NOTHING;

This is OK because the default is return zeros.

> I wrote:
> >> One argument against automatically "don't count non-INSTEAD rules and
> >> count the last statement in INSTEAD rules"
>
> Seems I introduced a little bit of confusion here by argueing against
> something that has never been proposed before. Funny, that this
> non-existent proposal is now seriously discussed :-(
>
> Has the idea of extending the syntax to explicitly mark queries as
> COUNTed already been rejected? If yes, I cannot help here. If no, I

Well, I am hoping to find something that was automatic. If we do our
best, and we still get complains, we can add some syntax. I am
concerned that adding syntax is just over-designing something that isn't
necessary.

> keep telling you that this approach can emulate most of the other
> possible solutions still under discussion.
>
> Bruce wrote:
> >If there is more than one matching tag in
> >the INSTEAD rule, the user has the option to place the query he wants
> >for the return at the end of the rule.
>
> Are you sure this is always possible without unwanted side effects?

I am sure it isn't always possible, but let's do our best and see how
people react.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-10-04 17:04:29 Re: [SQL] [GENERAL] CURRENT_TIMESTAMP
Previous Message Bruce Momjian 2002-10-04 16:53:11 Re: Return of INSTEAD rules