Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id BB0D970E777 for ; Fri, 9 Mar 2012 13:30:21 -0400 (AST) Received: from acidenitrix.villemain.org ([91.121.90.165]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S63dz-0005G3-NS for pgsql-hackers@postgresql.org; Fri, 09 Mar 2012 17:30:20 +0000 Received: from 89-158-241-83.rev.dartybox.com ([89.158.241.83] helo=DimIMac.local) by acidenitrix.villemain.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1S63di-00076j-8Z; Fri, 09 Mar 2012 18:30:02 +0100 Received: by DimIMac.local (Postfix, from userid 501) id DAF973CB0589; Fri, 9 Mar 2012 18:29:55 +0100 (CET) From: Dimitri Fontaine To: Robert Haas Cc: Thom Brown , Dimitri Fontaine , pgsql-hackers@postgresql.org, Andres Freund , Tom Lane Subject: Re: Command Triggers, patch v11 Organization: 2ndQuadrant References: <201203041650.39826.andres@anarazel.de> User-Mail-Address: dimitri@2ndQuadrant.fr Date: Fri, 09 Mar 2012 18:29:55 +0100 In-Reply-To: (Robert Haas's message of "Fri, 9 Mar 2012 09:30:14 -0500") Message-ID: User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.94 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/605 X-Sequence-Number: 204487 Robert Haas writes: > I'm not convinced. Right now, it's fairly useless - all the triggers > could possibly do is throw an error, and an error is going to get > thrown anyway, so it's only a question of which error message the user > will see. But we discussed before the idea of adding a capability for > BEFORE triggers to request that the actual execution of the command > get skipped, and then it's possible to imagine this being useful. > Someone could even use a command trigger that detects which machine > it's running on, and if it's the standby, uses dblink to execute the > command on the master, or something crazy like that. Command triggers > could also be useful for logging all attempts to execute a particular > command, which is probably still appropriate on the standby. There are some other use cases, like using plsh to go apt-get install an extension's package when you see the master just created it, so that your read only queries on the hot standby have a chance of loading the code you need. Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support