Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jAatH-0000bo-I1 for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2020 14:57:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jAatG-0008RM-BB for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2020 14:57:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jAatF-0008RF-Uf for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2020 14:57:22 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jAatD-0005Xb-HO for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2020 14:57:20 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 48ZSJG6knrz1NFj; Sat, 7 Mar 2020 09:57:18 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 48ZSJG5KWXzfYm; Sat, 7 Mar 2020 09:57:18 -0500 (EST) Date: Sat, 7 Mar 2020 09:57:18 -0500 From: stan To: Justin Cc: pgsql-general@lists.postgresql.org Subject: Re: Rules versus triggers Message-ID: <20200307145718.GB10796@panix.com> References: <20200307115615.GA27155@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Mar 07, 2020 at 09:47:39AM -0500, Justin wrote: > Hi Stan > > Rules actual are able to rewrite the SQL query sent to postgresql. Most > everyone suggestion is avoid rules. > > Triggers are just like every other databases Triggers firing off code for > Insert/Update/Delete/Truncate event > https://www.postgresql.org/docs/current/sql-createtrigger.html > So, the RULE can actually rewrite the query, instead of replacing it, which is what I m doing in the function, correct? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin