Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sD3dn-009qnG-AF for pgsql-general@arkaria.postgresql.org; Fri, 31 May 2024 14:54:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sD3dk-00CVEw-Fy for pgsql-general@arkaria.postgresql.org; Fri, 31 May 2024 14:53:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sD3dj-00CVEn-1f for pgsql-general@lists.postgresql.org; Fri, 31 May 2024 14:53:56 +0000 Received: from fout7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sD3dd-001giQ-Rf for pgsql-general@lists.postgresql.org; Fri, 31 May 2024 14:53:54 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 6259A13800C2; Fri, 31 May 2024 10:53:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 31 May 2024 10:53:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1717167228; x=1717253628; bh=uphyBJL37LdtOgxTrXaT6Qcno/1NyAozBA+CnGpWoBw=; b= VlpoB74CuSNDY2brGU15Y9H+rzZdWUdY/nWnwh8ElXgsjedTpQdBmCgvqHE8jsAm +FYiibNLcHkp1OFCUC++A+U99o8IOoT5puHylZud8KkMKaJ7U22m8U2LMAglzsqZ jTu+OLNkJuXiDetkI7NhrKVDhI4rt4BrgKsW7AoZtEvCnKSR0Rm7On1EUfs/K/CB aK1jHzI5OS86gxD9s7zWtAQcx4ZQsHq/HJDGgGV7xRWTiyslY0s8KzYFSHSTuI5T UaQ/8A5RSEGedHiKFgX+5JTnC3FoBiTK602/vmouXmAsWAVJB/hPDV4L029ErLc7 9nEteBY8YhF0ZdFmWLxYTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717167228; x= 1717253628; bh=uphyBJL37LdtOgxTrXaT6Qcno/1NyAozBA+CnGpWoBw=; b=H g0/681c7XjR5D1xnyOqgfDVKE+okDkMl+Jhz8UeuvY9Q+Wz7ON6z/4Z6xwpIerI2 dpkIpsmrhJiOBAgQWThhdZBkAkDCpgeka1LnAy8RhlTqjYmqTxuqqsicbXcmr6sm fU8s4ejCeMFk2ce8tBN/Dp5RJyeJpU0H6WTQeOQHjGW3aXpxMUlTuWQLPjmD+Nfe 6IZa++2ZG17oK3N8bf9KKflLjAFPHwLKLPJcdpzNZSlsvCmM5v93EpmFsj9hUzgv +nlqUvPVJmmPHnvxJZRmhIEaz1wQOgr2DtH0jA+Kk8BSGaRjWu+0BOytUEy9oZCr OBOoll3jbgFp1XSpgYtnA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekiedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepfeegfeeiuedtgffgteeggfehkeejheetieeliefg teeikeejvdeiveeigfehvedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 31 May 2024 10:53:47 -0400 (EDT) Message-ID: <72867dad-25b3-4bf1-a4e2-b739f9bffb72@aklaver.com> Date: Fri, 31 May 2024 07:53:46 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Rules and Command Status - update/insert/delete rule with series of commands in action To: "johnlumby@hotmail.com" , pgsql-general@lists.postgresql.org Cc: "David G. Johnston" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/30/24 15:34, johnlumby@hotmail.com wrote: > > On 5/30/24 4:56 PM, David G. Johnston wrote: >> >> Very little interest exists in working on user-specified rules.  They >> are practically deprecated. > > > Ah  -   pity  -   see my last comment to Adrian's > > >> >> Any interest in perhaps providing a choice via a configuration >> parameter? >> >> >>  If anything is done it would have to be new syntax. >> >> > A much bigger task surely. > > > On 5/30/24 5:19 PM, Adrian Klaver wrote: >> >> 2) Use INSTEAD OF triggers: >> >> > > Unfortunately the same functionality as in my example with the RULE is > not supported for triggers on views :   from the manual > > |INSTEAD OF| triggers may only be defined on views, *and only at row level*; > > > A RULE is essentially a statement-level operation which is what I need > for this particular case.      A row-level trigger would not work > because it cannot "see" the query causing it to be fired, and also , > (most importantly) is not fired at all if no rows match the original > query,     whereas a RULE is always in effect regardless of which rows > are involved. before.      I should add that the RULE I showed in my > example is not the only RULE being used on this view  -    there are > other conditional RULEs,   and the combined effect is of being able to > change the effect of the original statement into a set of new > statements,   one of which does what is needed. > Basically don't give the user what they asked for, give them some cobbled together on the fly version. Who decides that what the user needs? Seems to me this the point at which to have a discussion with the application developers about having the application asking the correct questions, rather then going down the road of bait and switch. > > And if you are now inclined to say "well,    maybe the application > itself is poorly written and should be changed"  -   I would have to > agree,    but that is not mine to change. > > > But I suppose that my next question,   given what you both say about the > RULE system being a dead-end,  is whether there is any likelihood of > supporting an INSTEAD OF trigger on a view at statement level?   Maybe > that stands more chance of going somewhere? > > > > Cheers,     John Lumby > > -- Adrian Klaver adrian.klaver@aklaver.com