Re: Why can't I put a BEFORE EACH ROW trigger on a view?

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Webb Sprague <webb(dot)sprague(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Date: 2007-02-25 01:15:12
Message-ID: 1172366112l.30468l.8l@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 02/24/2007 06:51:27 PM, Webb Sprague wrote:
>> . I have _additional_
>> constraints to place on modifications done through
>> views, and trickyness involved in modifying the
>> underlying tables.
>
> Write a function foo that returns a set, then a view: "create view as
> select * from foo()". Incorporate all the trickiness in the function,
> including variables, multiple temporary tables, whatever you need.

I tried that, and have already sent a message to this list about
it. The function needs to be passed NEW.* in order to know
what data it's looking at. When you try to do that you get
the following error message:

ERROR: function expression in FROM may not refer to other relations
of same query level

See:
http://archives.postgresql.org/pgsql-general/2007-02/msg01074.php

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karl O. Pinc 2007-02-25 01:20:24 Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Previous Message Karl O. Pinc 2007-02-25 01:11:22 Re: Why can't I put a BEFORE EACH ROW trigger on a view?