Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-03 Thread Dean Rasheed
On 2 April 2015 at 22:23, Robert Haas robertmh...@gmail.com wrote: On Thu, Apr 2, 2015 at 5:02 PM, Andres Freund and...@anarazel.de wrote: I think the upshot is that INSTEAD OF triggers work in a particular way because that's what is needed to support updatable views. If triggers on tables

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Aliouii Ali
and...@anarazel.de Cc: Tom Lane t...@sss.pgh.pa.us; Robert Haas robertmh...@gmail.com; Aliouii Ali aliouii@aol.fr; pgsql-hackers pgsql-hackers@postgresql.org Sent: Wed, Apr 1, 2015 8:01 pm Subject: Re: [HACKERS] Tables cannot have INSTEAD OF triggers On 1 April 2015 at 18:37, Andres Freund

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Robert Haas
On Thu, Apr 2, 2015 at 5:02 PM, Andres Freund and...@anarazel.de wrote: I think the upshot is that INSTEAD OF triggers work in a particular way because that's what is needed to support updatable views. If triggers on tables should behave differently, maybe it should be a separate trigger

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Peter Eisentraut
On 4/2/15 11:50 AM, Dean Rasheed wrote: Well actually the fact that the code is structured that way is somewhat academic. INSTEAD OF triggers on views don't support WHEN conditions -- deliberately so, since it would be difficult to know in general what to do if the trigger didn't fire. So

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Andres Freund
On 2015-04-02 16:42:43 -0400, Peter Eisentraut wrote: On 4/2/15 11:50 AM, Dean Rasheed wrote: Well actually the fact that the code is structured that way is somewhat academic. INSTEAD OF triggers on views don't support WHEN conditions -- deliberately so, since it would be difficult to know

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Dean Rasheed
On 2 April 2015 at 14:59, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Wed, Apr 1, 2015 at 1:56 PM, Tom Lane t...@sss.pgh.pa.us wrote: It would absolutely *not* be reasonable for WHEN conditions for triggers on tables to work completely differently than they

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Robert Haas
On Wed, Apr 1, 2015 at 1:56 PM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@anarazel.de writes: On 2015-04-01 13:29:33 -0400, Tom Lane wrote: WHEN won't help; if there are any INSTEAD OF triggers, no insert will happen, whether the triggers actually fire or not. Well, right now

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-02 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Wed, Apr 1, 2015 at 1:56 PM, Tom Lane t...@sss.pgh.pa.us wrote: It would absolutely *not* be reasonable for WHEN conditions for triggers on tables to work completely differently than they do for triggers on views. That ship's sailed. Clue me in,

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Andres Freund
On 2015-04-01 11:40:13 -0400, Robert Haas wrote: On Tue, Mar 31, 2015 at 8:49 AM, Aliouii Ali aliouii@aol.fr wrote: I don't see how this helps. The problem with partitioning is that you need a way to redirect the INSERT to another table, and there's no built-in way to do that, so you have

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Robert Haas
On Tue, Mar 31, 2015 at 8:49 AM, Aliouii Ali aliouii@aol.fr wrote: hi all, back in 2011(http://www.postgresql.org/message-id/1305138588.8811.3.ca...@vanquo.pezone.net), an question the same as this one was asked the anwser was : I think they're very useful on views, but I couldn't

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Andres Freund
On 2015-04-01 13:15:26 -0400, Tom Lane wrote: Andres Freund and...@anarazel.de writes: On 2015-04-01 12:46:05 -0400, Robert Haas wrote: So, the idea is that INSTEAD OF would behave like BEFORE but the tuple it returns wouldn't actually be inserted? That wasn't clear to me from the OP,

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Alvaro Herrera
Tom Lane wrote: Andres Freund and...@anarazel.de writes: On 2015-04-01 12:46:05 -0400, Robert Haas wrote: So, the idea is that INSTEAD OF would behave like BEFORE but the tuple it returns wouldn't actually be inserted? That wasn't clear to me from the OP, but I guess it would be a

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Andres Freund
On 2015-04-01 13:29:33 -0400, Tom Lane wrote: Andres Freund and...@anarazel.de writes: On 2015-04-01 13:15:26 -0400, Tom Lane wrote: If you have such a trigger, it's impossible to insert any rows, which means the table doesn't need storage, which means it may as well be a view, no? So

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Robert Haas
On Wed, Apr 1, 2015 at 12:04 PM, Andres Freund and...@2ndquadrant.com wrote: On 2015-04-01 11:40:13 -0400, Robert Haas wrote: I don't see how this helps. The problem with partitioning is that you need a way to redirect the INSERT to another table, and there's no built-in way to do that, so

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On 2015-04-01 13:29:33 -0400, Tom Lane wrote: WHEN won't help; if there are any INSTEAD OF triggers, no insert will happen, whether the triggers actually fire or not. Well, right now it doesn't work at all. It seems pretty reasonable to define things

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Dean Rasheed
On 1 April 2015 at 18:37, Andres Freund and...@anarazel.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

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On 2015-04-01 13:15:26 -0400, Tom Lane wrote: If you have such a trigger, it's impossible to insert any rows, which means the table doesn't need storage, which means it may as well be a view, no? So this still seems to me like a wart not a useful

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Andres Freund
On 2015-04-01 12:46:05 -0400, Robert Haas wrote: On Wed, Apr 1, 2015 at 12:04 PM, Andres Freund and...@2ndquadrant.com wrote: On 2015-04-01 11:40:13 -0400, Robert Haas wrote: Without INSTEAD OF you can't, to my knowledge, return a valid tuple from the top level table without also inserting

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2015-04-01 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On 2015-04-01 12:46:05 -0400, Robert Haas wrote: So, the idea is that INSTEAD OF would behave like BEFORE but the tuple it returns wouldn't actually be inserted? That wasn't clear to me from the OP, but I guess it would be a reasonable way to go. I'm

[HACKERS] Tables cannot have INSTEAD OF triggers

2015-03-31 Thread Aliouii Ali
hi all, back in 2011(http://www.postgresql.org/message-id/1305138588.8811.3.ca...@vanquo.pezone.net), an question the same as this one was asked the anwser was : I think they're very useful on views, but I couldn't think of a use-case for having them on tables. ISTM that anything an INSTEAD

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2011-05-12 Thread Dean Rasheed
On 11 May 2011 19:51, Tom Lane t...@sss.pgh.pa.us wrote: Peter Eisentraut pete...@gmx.net writes: Why not?  Is there a fundamental problem, or just that no one wanted to make it work? More the latter really. I think they're very useful on views, but I couldn't think of a use-case for having

[HACKERS] Tables cannot have INSTEAD OF triggers

2011-05-11 Thread Peter Eisentraut
Why not? Is there a fundamental problem, or just that no one wanted to make it work? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Tables cannot have INSTEAD OF triggers

2011-05-11 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes: Why not? Is there a fundamental problem, or just that no one wanted to make it work? I'm fairly sure there was a substantive issue, but memory fails as to what it was. You could try removing the error check and see what breaks ...