Re: Bug in PL/pgSQL GET DIAGNOSTICS?

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: Bug in PL/pgSQL GET DIAGNOSTICS?
Date: 2002-09-28 23:20:43
Message-ID: 200209282320.g8SNKhN22833@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


OK, that is a good example. It would return the sum of the matching
tags. You are suggesting here that it would be better to take the
result of the last matching tag command, right?

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

Manfred Koizar wrote:
> On Sat, 28 Sep 2002 13:41:04 -0400 (EDT), Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> >Does anyone else have a common rule that would return incorrect results
> >using the proposed rules?
>
> CREATE VIEW twotables AS
> SELECT ... FROM table1 INNER JOIN table2 ON ... ;
>
> CREATE RULE twotables_insert AS -- INSERT rule
> ON INSERT TO twotables
> DO INSTEAD (
> INSERT INTO table1 VALUES (new.pk, new.col1);
> INSERT INTO table2 VALUES (new.pk, new.col2)
> );
>
> CREATE RULE twotables_update AS -- UPDATE rule
> ON UPDATE TO twotables
> DO INSTEAD (
> UPDATE table1 SET col1 = new.col1 WHERE pk = old.pk;
> UPDATE table2 SET col2 = new.col2 WHERE pk = old.pk
> );
>
> CREATE RULE twotables_delete AS -- DELETE rule
> ON DELETE TO twotables
> DO INSTEAD (
> DELETE FROM table1 WHERE pk = old.pk;
> DELETE FROM table2 WHERE pk = old.pk
> );
>
> CREATE VIEW visible AS
> SELECT ... FROM table3
> WHERE deleted = 0;
>
> CREATE RULE visible_delete AS -- DELETE rule
> ON DELETE TO visible
> DO INSTEAD
> UPDATE table3
> SET deleted = 1
> WHERE pk = old.pk;
>
> Servus
> Manfred
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2002-09-29 00:06:04 Re: DROP COLUMN misbehaviour with multiple inheritance
Previous Message Giles Lean 2002-09-28 22:58:29 Re: Upgrade process (was Re: 7.2.3?)