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.96) (envelope-from ) id 1vvzfE-00EOBq-2Z for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 15:22:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvzfC-004LrS-2u for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 15:21:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vvzfC-004LrA-23 for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 15:21:58 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vvzf9-00000001W8x-1ugz for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 15:21:57 +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 61RFLhIP852983; Fri, 27 Feb 2026 10:21:43 -0500 From: Tom Lane To: Richard Guo cc: Swirl Smog Dowry , pgsql-bugs@lists.postgresql.org Subject: Re: pg_get_viewdef() produces non-round-trippable SQL for views with USING join on mismatched integer types In-reply-to: References: <643857.1772122240@sss.pgh.pa.us> <717830.1772130430@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Fri, 27 Feb 2026 17:13:52 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <852981.1772205703.1@sss.pgh.pa.us> Date: Fri, 27 Feb 2026 10:21:43 -0500 Message-ID: <852982.1772205703@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > I am on the fence about whether this fix is safe to back-patch to v18. I don't think we have a lot of choice. The cases where it makes a difference are pretty broken. Fortunately, I think these cases are rare. JOIN USING combining two different-type columns has got to be an edge-case usage, and I think it likely doesn't matter much in other cases. > However, this fix will only apply to newly created views. Users who > have existing views affected by this bug will have to recreate them > after upgrading to get the corrected pg_get_viewdef output. Yeah :-(. What's really annoying is that probably people will not notice until they try to upgrade to v19, and by then recreating the view correctly might be difficult. But I'm not seeing a way to smooth their path. regards, tom lane