Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX2hu-0002Ac-Qj for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 15:15:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nX2gv-0004oN-Kq for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 15:14:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX2gv-0004oE-BQ for pgsql-hackers@lists.postgresql.org; Wed, 23 Mar 2022 15:14:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX2gs-0005a7-Rk for pgsql-hackers@postgresql.org; Wed, 23 Mar 2022 15:14:28 +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 22NFENUJ2719158; Wed, 23 Mar 2022 11:14:23 -0400 From: Tom Lane To: Peter Eisentraut cc: pgsql-hackers Subject: Re: Use JOIN USING aliases in ruleutils.c In-reply-to: <3df848ce-f0cc-3211-2df5-abe19c11a8e9@enterprisedb.com> References: <3df848ce-f0cc-3211-2df5-abe19c11a8e9@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Mon, 07 Feb 2022 09:06:54 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2719156.1648048463.1@sss.pgh.pa.us> Date: Wed, 23 Mar 2022 11:14:23 -0400 Message-ID: <2719157.1648048463@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > When reverse-compiling a query, ruleutils.c has some complicated code to > handle the join output columns of a JOIN USING join. There used to be > no way to qualify those columns, and so if there was a naming conflict > anywhere in the query, those output columns had to be renamed to be > unique throughout the query. > Since PostgreSQL 14, we have a new feature that allows adding an alias > to a JOIN USING clause. This provides a better solution to this > problem. I looked this over briefly, and came away fairly dissatisfied. My big fear is that it will reduce portability of pg_dump output: views that would have loaded successfully into pre-v14 servers no longer will, and your chances of porting them to other RDBMSes probably go down too. Once v13 becomes EOL, that will be less of a concern, but I think it's a valid objection for awhile yet. Also, it doesn't seem like we're getting much in return for the portability hazard. AFAICS the patch actually makes a net addition of code to ruleutils.c, which perhaps means that you've not worked hard enough on removing no-longer-needed code. Maybe there's an argument that the new output is more readable, but these regression test changes don't look like any huge step forward to me. > I also just named the generated > aliases "ju" with numbers added, maybe there are other ideas for how to > generate these names. For my taste, names like "join_N" would be better. On the whole, I'd recommend putting this idea on the back burner for three or four years more. regards, tom lane