Re: [HACKERS] Rules: A Modest Proposal

2009-10-08 Thread Chris Browne
sfr...@snowman.net (Stephen Frost) writes: * David Fetter (da...@fetter.org) wrote: On Sun, Oct 04, 2009 at 04:07:40PM -0400, Robert Haas wrote: The radical proposal was the RULE system.  It's been tested now, and it's pretty much failed. You still haven't explained what actual

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Peter Eisentraut
On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote: I am not sure where that view implemenation is, but I doubt its stalled because of the rule system. It is. You can definitely create updatable views using rules. Sure you can, but they won't work in various significant corner cases.

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Peter Eisentraut
On Sun, 2009-10-04 at 20:54 -0400, Alvaro Herrera wrote: While I don't agree with David Fetter's premise, I think rehashing how we handle VIEWs would be a good step towards updatable views. Right now, the implementation of that is stalled precisely because of the rule system. The way forward

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Bernd Helmle
--On 5. Oktober 2009 09:51:29 +0300 Peter Eisentraut pete...@gmx.net wrote: The way forward with updatable views is triggers on views. I was going to write something about that in the future. I haven't worked out all the details. In the mentioned discussion there was already the notion

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Bernd Helmle
--On 4. Oktober 2009 21:37:45 -0400 Robert Haas robertmh...@gmail.com wrote: This is the last I remember hearing of it, which seems to suggest that only a week's worth of work (maybe a bit more for those of us who are not Tom Lane) is needed:

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 At the moment, user-accessible RULEs have, as far as I know, just two sane uses:

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Bruce Momjian
Greg Sabino Mullane wrote: Could this be done with a trigger? Yes, but on the plus rules side: * It's faster * It's easier to write * It's immediately viewable as to what is going on with a \d mytable * Dropping it won't leave an unused function around * We can still do ALTER TABLE DISABLE

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Andrew Gierth
Greg == Greg Sabino Mullane g...@turnstep.com writes: They're mostly a foot-gun. Greg Lots of things in Postgres could be considered potential foot Greg guns. Frankly, I don't think rules are even near the top of Greg such a list. Can you give examples of rule foot guns? There are so many

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Martijn van Oosterhout
On Mon, Oct 05, 2009 at 02:53:56PM +0100, Andrew Gierth wrote: Here are a couple of the more common ones: 1) any reference in an insert rule to NEW.col where col has a volatile default, or the expression in the insert statement was volatile, or the expression's value is changed by the

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Tom Lane
Martijn van Oosterhout klep...@svana.org writes: ISTM it may be possible to use the new WITH construct here. So the rule evaluation for the following create table t (a integer); create table t_log (a integer); create rule t_ins AS ON insert TO t do also insert into t_log values (NEW.a);

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Martijn van Oosterhout
On Mon, Oct 05, 2009 at 10:32:53AM -0400, Tom Lane wrote: Martijn van Oosterhout klep...@svana.org writes: WITH NEW AS ( insert into t values (floor(random()*1000)::integer); RETURNING * ) insert into t_log values (NEW.a); Would this not have the required semantics?

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Dan Colish
On Mon, Oct 05, 2009 at 09:50:18AM +0300, Peter Eisentraut wrote: On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote: I am not sure where that view implemenation is, but I doubt its stalled because of the rule system. It is. You can definitely create updatable views using rules.

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Alvaro Herrera
Dan Colish wrote: On Mon, Oct 05, 2009 at 09:50:18AM +0300, Peter Eisentraut wrote: On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote: You can definitely create updatable views using rules. Sure you can, but they won't work in various significant corner cases. Search the

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Dan Colish
On Mon, Oct 05, 2009 at 11:28:13AM -0400, Alvaro Herrera wrote: Dan Colish wrote: On Mon, Oct 05, 2009 at 09:50:18AM +0300, Peter Eisentraut wrote: On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote: You can definitely create updatable views using rules. Sure you can, but they

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Pavel Stehule
2009/10/5 Dan Colish d...@unencrypted.org: On Mon, Oct 05, 2009 at 11:28:13AM -0400, Alvaro Herrera wrote: Dan Colish wrote: On Mon, Oct 05, 2009 at 09:50:18AM +0300, Peter Eisentraut wrote: On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote:  You can definitely create updatable views

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread David Fetter
On Mon, Oct 05, 2009 at 11:28:13AM -0400, Alvaro Herrera wrote: Dan Colish wrote: On Mon, Oct 05, 2009 at 09:50:18AM +0300, Peter Eisentraut wrote: On Sun, 2009-10-04 at 18:24 -0700, Dan Colish wrote: You can definitely create updatable views using rules. Sure you can, but they

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Kevin Grittner
Stephen Frost sfr...@snowman.net wrote: Do we have a patch which implements the necessary mechanics to replace RULEs, even for the specific situations you list? Until then, I don't think there's much to discuss. I thought that until we had discussion and consensus it was premature to start

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Stephen Frost
* Kevin Grittner (kevin.gritt...@wicourts.gov) wrote: Stephen Frost sfr...@snowman.net wrote: Do we have a patch which implements the necessary mechanics to replace RULEs, even for the specific situations you list? Until then, I don't think there's much to discuss. I thought that until

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Josh Berkus
Andrew, 1) any reference in an insert rule to NEW.col where col has a volatile default, or the expression in the insert statement was volatile, or the expression's value is changed by the insert, will do the wrong thing: Is this different from triggers? 2) any rule with multiple

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Andrew Gierth
Josh == Josh Berkus j...@agliodbs.com writes: 1) any reference in an insert rule to NEW.col where col has a volatile default, or the expression in the insert statement was volatile, or the expression's value is changed by the insert, will do the wrong thing: Josh Is this different from

Re: [HACKERS] Rules: A Modest Proposal

2009-10-05 Thread Greg Stark
On Mon, Oct 5, 2009 at 10:17 AM, Josh Berkus j...@agliodbs.com wrote: So while rules are hard to use and easy to mess up, so are triggers.  So while an (arguable) problem is being pointed out, no real solution is being proposed. If you want to implement updatable views I still stand by my

[HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David Fetter
Folks, At the moment, user-accessible RULEs have, as far as I know, just two sane uses: * Writing to VIEWs * Routing writes to partitions And the second is pretty thin, given the performance issues for numbers of partitions over 2. What say we see about addressing those problems separately,

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Pavel Stehule
2009/10/4 David Fetter da...@fetter.org: Folks, At the moment, user-accessible RULEs have, as far as I know, just two sane uses: * Writing to VIEWs * Routing writes to partitions somebody use it as instead triggers. And I am sure, so there are people, who use it for writable views.

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Josh Berkus
There are already patches to deal with the first, at least for the kinds of VIEWs where this can be deduced automatically, and people are starting to take on the second. How would we deal with VIEWs which weren't simple enough for automated updating, then? I don't think that removing a major

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Dan Colish
On Sun, Oct 04, 2009 at 11:42:45AM -0700, Josh Berkus wrote: There are already patches to deal with the first, at least for the kinds of VIEWs where this can be deduced automatically, and people are starting to take on the second. How would we deal with VIEWs which weren't simple enough

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Andrew Dunstan
Dan Colish wrote: When you speak of writing to a view, what do you mean exactly? Are we saying refresh a view or update the parent tables of a view? He means INSERT, UPDATE and DELETE operations on the view. cheers andrew -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David Fetter
On Sun, Oct 04, 2009 at 08:48:15PM +0200, Pavel Stehule wrote: 2009/10/4 David Fetter da...@fetter.org: Folks, At the moment, user-accessible RULEs have, as far as I know, just two sane uses: * Writing to VIEWs * Routing writes to partitions somebody use it as instead triggers.

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Dan Colish
On Sun, Oct 04, 2009 at 03:15:10PM -0400, Andrew Dunstan wrote: Dan Colish wrote: When you speak of writing to a view, what do you mean exactly? Are we saying refresh a view or update the parent tables of a view? He means INSERT, UPDATE and DELETE operations on the view. cheers

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David Fetter
On Sun, Oct 04, 2009 at 11:42:45AM -0700, Josh Berkus wrote: There are already patches to deal with the first, at least for the kinds of VIEWs where this can be deduced automatically, and people are starting to take on the second. How would we deal with VIEWs which weren't simple enough

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Robert Haas
On Sun, Oct 4, 2009 at 3:34 PM, David Fetter da...@fetter.org wrote: What would be the benefit of this radical proposal? The radical proposal was the RULE system.  It's been tested now, and it's pretty much failed. You still haven't explained what actual benefit we'd get out of doing this. I

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Pavel Stehule
2009/10/4 David Fetter da...@fetter.org: On Sun, Oct 04, 2009 at 08:48:15PM +0200, Pavel Stehule wrote: 2009/10/4 David Fetter da...@fetter.org: Folks, At the moment, user-accessible RULEs have, as far as I know, just two sane uses: * Writing to VIEWs * Routing writes to partitions

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Josh Berkus
David, The radical proposal was the RULE system. It's been tested now, and it's pretty much failed. I don't think you've demonstrated that. I know *you* don't like RULEs, but others do. I could propose that UUIDs are a bankrupt concept (which I believe) and therefore we should drop the UUID

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David Fetter
On Sun, Oct 04, 2009 at 01:25:31PM -0700, Josh Berkus wrote: David, The radical proposal was the RULE system. It's been tested now, and it's pretty much failed. I don't think you've demonstrated that. I know *you* don't like RULEs, but others do. It's less about like or dislike and

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David Fetter
On Sun, Oct 04, 2009 at 04:07:40PM -0400, Robert Haas wrote: On Sun, Oct 4, 2009 at 3:34 PM, David Fetter da...@fetter.org wrote: What would be the benefit of this radical proposal? The radical proposal was the RULE system.  It's been tested now, and it's pretty much failed. You still

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Stephen Frost
* David Fetter (da...@fetter.org) wrote: On Sun, Oct 04, 2009 at 04:07:40PM -0400, Robert Haas wrote: The radical proposal was the RULE system.  It's been tested now, and it's pretty much failed. You still haven't explained what actual benefit we'd get out of doing this. Removing

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Larry Rosenman
On Sun, October 4, 2009 1:48 pm, Pavel Stehule wrote: 2009/10/4 David Fetter da...@fetter.org: Folks, At the moment, user-accessible RULEs have, as far as I know, just two sane uses: * Writing to VIEWs * Routing writes to partitions somebody use it as instead triggers. And I am sure, so

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread David E. Wheeler
On Oct 4, 2009, at 1:57 PM, David Fetter wrote: It's less about like or dislike and more about facing up to the reality that we've got a major legacy foot-gun left over from the experimentation of the Berkeley days. I think you're going to need to be a bit more concrete than that. In what

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Robert Haas
On Sun, Oct 4, 2009 at 6:42 PM, David Fetter da...@fetter.org wrote: I agree that rules, except for SELECT rules, don't seem to be very useful.  Perhaps others have found them so, but I have found triggers to be a better fit for everything that I ever want to do. Every time I think, hmm, maybe

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Alvaro Herrera
David E. Wheeler wrote: On Oct 4, 2009, at 1:57 PM, David Fetter wrote: It's less about like or dislike and more about facing up to the reality that we've got a major legacy foot-gun left over from the experimentation of the Berkeley days. I think you're going to need to be a bit more

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Dan Colish
On Sun, Oct 04, 2009 at 08:54:56PM -0400, Alvaro Herrera wrote: David E. Wheeler wrote: On Oct 4, 2009, at 1:57 PM, David Fetter wrote: It's less about like or dislike and more about facing up to the reality that we've got a major legacy foot-gun left over from the experimentation of

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Robert Haas
On Sun, Oct 4, 2009 at 8:54 PM, Alvaro Herrera alvhe...@commandprompt.com wrote: David E. Wheeler wrote: On Oct 4, 2009, at 1:57 PM, David Fetter wrote: It's less about like or dislike and more about facing up to the reality that we've got a major legacy foot-gun left over from the

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Alvaro Herrera
Robert Haas escribió: While I don't agree with David Fetter's premise, I think rehashing how we handle VIEWs would be a good step towards updatable views.  Right now, the implementation of that is stalled precisely because of the rule system. This is the last I remember hearing of it,

Re: [HACKERS] Rules: A Modest Proposal

2009-10-04 Thread Robert Haas
On Sun, Oct 4, 2009 at 10:01 PM, Alvaro Herrera alvhe...@commandprompt.com wrote: Robert Haas escribió: While I don't agree with David Fetter's premise, I think rehashing how we handle VIEWs would be a good step towards updatable views.  Right now, the implementation of that is stalled