Re: Issue with functions in Rule

From: Richard Huxton <dev(at)archonet(dot)com>
To: Hakan Kocaman <Hakan(dot)Kocaman(at)digame(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Issue with functions in Rule
Date: 2005-10-19 07:58:30
Message-ID: 4355FCA6.3070509@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hakan Kocaman wrote:
> Hello Folks,
>
> first i want to apologize for my bad english :~)
> we got here apparntly 2 issues with the above mentioned functionality:
>
> 1. I want to use functions with composite types as parameters,
> which is no deal on our current production server(postgres 7.4.3)
> but don't work on our upcoming production server(8.0.3).
> A sample function is attached.
> The function uses a composite type from a view, which declaration
> is alos attached.
> In this thread it is mentioned as a bug:
> http://archives.postgresql.org/pgsql-admin/2005-08/msg00153.php
> The question is if it's fixed in 8.0.4 or 8.1.
>
> 2. Using the mentioned function in a rule on the mentioned view
> clashs on the fact, that we don't find a appropriate way for the syntax.
> The rule is also attached.

CREATE OR REPLACE RULE update_produkte AS
ON UPDATE TO viewprodukte DO INSTEAD
SELECT fu_upd_viewprodukte(vp1.*, vp2.*) AS fu_upd_viewprodukte
FROM viewprodukte vp1, viewprodukte vp2
WHERE vp1.id = new.id AND vp2.id = old.id;

Well, as a short-term workaround, surely you could rewrite this to take
(new.id,old.id) as parameters instead?

I also can't reproduce your problem in 8.0.3 on my Debian-based system
here. I've attached my test-script - am I missing something?

--
Richard Huxton
Archonet Ltd

Attachment Content-Type Size
view_rectype_fn.sql text/x-sql 715 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Rae 2005-10-19 08:46:22 Re: PostgreSQL on Dual Processors, Dual-Core AMD Chips
Previous Message Hannes Dorbath 2005-10-19 07:56:04 Re: Restoring Database created on windows on FreeBSD