Re: Tables cannot have INSTEAD OF triggers

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Aliouii Ali <aliouii(dot)ali(at)aol(dot)fr>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tables cannot have INSTEAD OF triggers
Date: 2015-04-01 19:01:11
Message-ID: CAEZATCUc5h2H9bVaX2KvCm28WMXckVi=O3+qmhqPt2vGW4vOCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1 April 2015 at 18:37, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2015-04-01 13:29:33 -0400, Tom Lane wrote:
>> As for partitioning, you could do this:
>>
>> create table parent(...);
>> create table child(...) inherits(parent); -- repeat as needed
>> create view v as select * from parent;
>> attach INSTEAD OF triggers to v
>>
>> Now the application deals only with v, and thinks that's the real
>> table.
>
> Sure, but that's just making things unnecessarily hard. That then
> requires also defining UPDATE/DELETE INSTEAD triggers which otherwise
> would just work.
>

No, because as defined above the view v would be auto-updatable, so
updates and deletes on v would just do the matching update/delete on
parent.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-04-01 19:04:28 Re: Bug #10432 failed to re-find parent key in index
Previous Message Andrew Dunstan 2015-04-01 18:46:01 Re: How about to have relnamespace and relrole?