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 1qyYYK-00997y-Uq for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Nov 2023 14:20:08 +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 1qyYYJ-00DTUZ-JH for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Nov 2023 14:20:07 +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 1qyYYJ-00DTUQ-An for pgsql-bugs@lists.postgresql.org; Thu, 02 Nov 2023 14:20:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyYYG-004Kxb-TF for pgsql-bugs@lists.postgresql.org; Thu, 02 Nov 2023 14:20:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3A2EK21M3027425; Thu, 2 Nov 2023 10:20:02 -0400 From: Tom Lane To: joshua.uyehara@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18178: New Restriction on "ON SELECT" rules on tables In-reply-to: <18178-05534d7064044d2d@postgresql.org> References: <18178-05534d7064044d2d@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 01 Nov 2023 23:25:48 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3027423.1698934802.1@sss.pgh.pa.us> Date: Thu, 02 Nov 2023 10:20:02 -0400 Message-ID: <3027424.1698934802@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The documentation for rules specifically states that "ON SELECT" rules can > be created on tables (and I have functionality/use cases that rely on that) > behavior, but pg16 breaks that. If the documentation still says that, it needs to be updated. What are you looking at precisely? > The issue is, basically, that there are broad classes of database > abstraction middleware that are configured via database introspection at > runtime and do not understand or implement the concept of updateable views > and foreign tables. The easiest workaround for that limitation in postgres > has always been to create a local table stand-in with all operations > rerouted to the foreign table via rules. TBH, I don't believe that argument for a second. Pre-v16, what happened when you added an ON SELECT rule to a table is that *the table got changed into a view* (which is what caused the bugs mentioned in the thread Daniel pointed you to). There is no difference between the subsequent catalog state and what you would have if you'd just created it as a view in the first place. So do that and then add whatever non-SELECT rules you need, and you should be in the same place as before (and your code will still work with pre-v16 releases, too). regards, tom lane