Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Robert Haas
On Sun, Mar 25, 2012 at 12:15 PM, Andres Freund and...@2ndquadrant.com wrote: On Friday, March 16, 2012 10:40:46 AM Dimitri Fontaine wrote: This will have the effect of calling triggers outside of alphabetic order. I don't think thats a good idea even if one part is ANY and the other a

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Dimitri Fontaine
Robert Haas robertmh...@gmail.com writes: Dimitri's proposed behavior would be advantageous if you have an ANY trigger that wants to take over the world and make sure that nobody else can run before it. I think, though, that's not a case we want to cater to - all of this stuff requires

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Thom Brown
Can someone clarify whether this will be reviewed by a committer? Will there be time to get this reviewed before the commitfest closes? I get the impression the commitfest closure is fairly imminent. Thom -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Robert Haas
On Mon, Mar 26, 2012 at 3:24 PM, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: One use case would be for londiste/slony/bucardo to rewrite the command and queue its text, that will be done in C and should probably be done first. Using an ANY command trigger means that code will run before user

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Tom Lane
Dimitri Fontaine dimi...@2ndquadrant.fr writes: Robert Haas robertmh...@gmail.com writes: Dimitri's proposed behavior would be advantageous if you have an ANY trigger that wants to take over the world and make sure that nobody else can run before it. I think, though, that's not a case we want

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Tom Lane
Thom Brown thombr...@gmail.com writes: Can someone clarify whether this will be reviewed by a committer? Will there be time to get this reviewed before the commitfest closes? I get the impression the commitfest closure is fairly imminent. I don't have that impression. (I wish I did.)

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Robert Haas
On Mon, Mar 26, 2012 at 3:36 PM, Thom Brown thombr...@gmail.com wrote: Can someone clarify whether this will be reviewed by a committer? Will there be time to get this reviewed before the commitfest closes? I get the impression the commitfest closure is fairly imminent. Well, I have been

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes: So I don't think that the mere fact of being an ANY trigger rather than a command-specific trigger should be taken to mean that a particular ordering is desirable. Trigger name order isn't the greatest solution by any means, but it's more flexible than

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Andres Freund
On Monday, March 26, 2012 10:18:59 PM Dimitri Fontaine wrote: don't know how to fix the plpython specifics he's talking about. Just copy what is done in the normal trigger handling facility (the decref both in the CATCH and in the normal path). Ping me some other way if you need help...

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Dimitri Fontaine
Robert Haas robertmh...@gmail.com writes: 1. It sure seems like there is an awful lot of code churn and design work going on. There has only been minor adjustments for a while now, and they have been visible because Thom was doing lots of testing for me and it was way easier for me to publish a

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Thom Brown
On 26 March 2012 21:36, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Robert Haas robertmh...@gmail.com writes: Personally, I am about at the point where I'd like to punt everything and move on.  As nice as it would be to squeeze a few more things into 9.2, there WILL be a 9.3.  If a few less

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Robert Haas
On Mon, Mar 26, 2012 at 4:36 PM, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Well, wait a minute. There's a difference between half-baked and reacting to a review that changes the goal of a patch. My idea of the code I wanted to write here is extremely different from what we as a community

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Christopher Browne
On Mon, Mar 26, 2012 at 4:45 PM, Robert Haas robertmh...@gmail.com wrote: As soon as we're done here, the CommitFest will end, and there won't be any other people's patches to review. Hurray? :-) -- When confronted by a difficult problem, solve it by reducing it to the question, How would the

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: 2. I'm not sure which patches Tom is planning to look at or in what order, so I've been avoiding the ones he seems to be taking an interest in. Well, I think I'm definitely on the hook for the pg_stat_statements, pgsql_fdw, foreign table stats, and

Re: [HACKERS] Command Triggers, v16

2012-03-26 Thread Robert Haas
On Mar 26, 2012, at 5:36 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: 2. I'm not sure which patches Tom is planning to look at or in what order, so I've been avoiding the ones he seems to be taking an interest in. Well, I think I'm definitely on the hook

Re: [HACKERS] Command Triggers, v16

2012-03-25 Thread Andres Freund
On Friday, March 16, 2012 10:40:46 AM Dimitri Fontaine wrote: This will have the effect of calling triggers outside of alphabetic order. I don't think thats a good idea even if one part is ANY and the other a specific command. I don't think there is any reason anymore to separate the two?

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Andres Freund
On Thursday, March 15, 2012 11:41:21 PM Thom Brown wrote: On 15 March 2012 22:06, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: At this moment in time, CTAS is still outstanding. Is the plan to try to get that in for this release, or as an

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Christian Ullrich
* Thom Brown wrote: I don’t understand how functions can return a type of “command trigger”. This certainly works, but I’ve never seen a type consisting of more than one word. Could you explain this for me? This is also postgres= with types (name) as postgres- (select format_type(oid,

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 16 March 2012 08:13, Andres Freund and...@anarazel.de wrote: On Thursday, March 15, 2012 11:41:21 PM Thom Brown wrote: Looks like the ctas-on-command-triggers-01.patch patch needs re-basing. I can do that - but imo the other patch (not based on the command triggers stuff) is the relevant

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Andres Freund
Hi, On Thursday, March 15, 2012 10:58:49 PM Dimitri Fontaine wrote: I tricked that in the grammar, the type is called cmdtrigger but I though it wouldn't be a good choice for the SQL statement. Hm. I am decidedly unhappy with that grammar hackery... But then maybe I am squeamish. + oid |

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Andres Freund
On Friday, March 16, 2012 09:30:58 AM Thom Brown wrote: On 16 March 2012 08:13, Andres Freund and...@anarazel.de wrote: On Thursday, March 15, 2012 11:41:21 PM Thom Brown wrote: Looks like the ctas-on-command-triggers-01.patch patch needs re-basing. I can do that - but imo the other

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 15 March 2012 21:58, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Thom Brown thombr...@gmail.com writes: I don’t understand how functions can return a type of “command trigger”.  This certainly works, but I’ve never seen a type consisting of more than one word.  Could you explain this for

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 16 March 2012 08:45, Andres Freund and...@anarazel.de wrote: On Friday, March 16, 2012 09:30:58 AM Thom Brown wrote: On 16 March 2012 08:13, Andres Freund and...@anarazel.de wrote: On Thursday, March 15, 2012 11:41:21 PM Thom Brown wrote: Looks like the ctas-on-command-triggers-01.patch

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Andres Freund
On Friday, March 16, 2012 09:55:10 AM Thom Brown wrote: On 16 March 2012 08:45, Andres Freund and...@anarazel.de wrote: On Friday, March 16, 2012 09:30:58 AM Thom Brown wrote: On 16 March 2012 08:13, Andres Freund and...@anarazel.de wrote: On Thursday, March 15, 2012 11:41:21 PM Thom Brown

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Dimitri Fontaine
Andres Freund and...@anarazel.de writes: On Thursday, March 15, 2012 10:58:49 PM Dimitri Fontaine wrote: I tricked that in the grammar, the type is called cmdtrigger but I though it wouldn't be a good choice for the SQL statement. Hm. I am decidedly unhappy with that grammar hackery... But

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Dimitri Fontaine
Thom Brown thombr...@gmail.com writes: Note: incremental patch attached for the following section... Applied, thanks! I don’t know if this was a problem before that I didn’t spot (probably), but triggers for both ANY COMMAND and ALTER FOREIGN TABLE show a command tag of ALTER TABLE for ALTER

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 16 March 2012 11:42, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Thom Brown thombr...@gmail.com writes: Specific command triggers on ALTER VIEW don’t work at all: Can't reproduce, and that's already part of the regression tests. This was a problem my side (a mistake I made previously)

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Dimitri Fontaine
Thom Brown thombr...@gmail.com writes: Okay, I shalln't do any more testing until the next patch. I should probably have worked on automating my tests more, but never got round to it. make installcheck :) That said, your test allow to spot OID problems that we can't add in the regression

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 16 March 2012 12:07, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Thom Brown thombr...@gmail.com writes: Okay, I shalln't do any more testing until the next patch.  I should probably have worked on automating my tests more, but never got round to it.  make installcheck :) That said,

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On Thursday, March 15, 2012 10:58:49 PM Dimitri Fontaine wrote: I tricked that in the grammar, the type is called cmdtrigger but I though it wouldn't be a good choice for the SQL statement. Hm. I am decidedly unhappy with that grammar hackery... But

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Andres Freund
On Friday, March 16, 2012 02:50:55 PM Tom Lane wrote: While I'm looking at the grammar ... it also seems like a serious PITA from a maintenance standpoint that we're now going to have to adjust the CREATE COMMAND TRIGGER productions every time somebody thinks of a new SQL command. I don't

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On Friday, March 16, 2012 02:50:55 PM Tom Lane wrote: While I'm looking at the grammar ... it also seems like a serious PITA from a maintenance standpoint that we're now going to have to adjust the CREATE COMMAND TRIGGER productions every time somebody

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes: Multi-word type names are a serious pain in the ass; they require hackery in a lot of places. We support the ones that the SQL spec requires us to, but I will object in the strongest terms to inventing any that are not required by spec. I object in even

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Robert Haas
On Fri, Mar 16, 2012 at 7:42 AM, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: I don’t know if this was a problem before that I didn’t spot (probably), but triggers for both ANY COMMAND and ALTER FOREIGN TABLE show a command tag of ALTER TABLE for ALTER FOREIGN TABLE statements where the

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Dimitri Fontaine
Robert Haas robertmh...@gmail.com writes: there has to be some way to do that without breaking command triggers. Sure, special case the switch branch in utility.c so as to return a different command tag for ALTER TABLE and ALTER FOREIGN TABLE. For precedents, see

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Tom Lane
Dimitri Fontaine dimi...@2ndquadrant.fr writes: Tom Lane t...@sss.pgh.pa.us writes: If you think cmdtrigger isn't a good name maybe you should have picked a different one to start with. Well, I think it's a good internal name. I'm not too sure about exposing it, the only reason why it's a

Re: [HACKERS] Command Triggers, v16

2012-03-16 Thread Thom Brown
On 16 March 2012 16:26, Tom Lane t...@sss.pgh.pa.us wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: Tom Lane t...@sss.pgh.pa.us writes: If you think cmdtrigger isn't a good name maybe you should have picked a different one to start with. Well, I think it's a good internal name. I'm

Re: [HACKERS] Command Triggers, v16

2012-03-15 Thread Thom Brown
On 15 March 2012 18:13, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Hi, I guess it's time to start a new thread here. Please find attached version 16 of the command trigger patch, with augmented documentation and “magic variable” support (TG_WHEN, TG_OBJECTID and such). The current

Re: [HACKERS] Command Triggers, v16

2012-03-15 Thread Dimitri Fontaine
Thanks for testing this new version (again). A quick answer now, I'll send another patch tomorrow. Thom Brown thombr...@gmail.com writes: I don’t understand how functions can return a type of “command trigger”. This certainly works, but I’ve never seen a type consisting of more than one

Re: [HACKERS] Command Triggers, v16

2012-03-15 Thread Dimitri Fontaine
Dimitri Fontaine dimi...@2ndquadrant.fr writes: At this moment in time, CTAS is still outstanding. Is the plan to try to get that in for this release, or as an enhancement in 9.3? The plan is to get CTAS as a utility command in 9.2 then update the command trigger patch to benefit from the

Re: [HACKERS] Command Triggers, v16

2012-03-15 Thread Thom Brown
On 15 March 2012 22:06, Dimitri Fontaine dimi...@2ndquadrant.fr wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: At this moment in time, CTAS is still outstanding.  Is the plan to try to get that in for this release, or as an enhancement in 9.3? The plan is to get CTAS as a utility