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 1joLqn-0001Cj-Ms for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 06:59:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joLqm-0007Bb-Kc for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 06:59:08 +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 1joLqm-0007BU-Dh for pgsql-hackers@lists.postgresql.org; Thu, 25 Jun 2020 06:59:08 +0000 Received: from courriel-2.mines-paristech.fr ([77.158.173.19] helo=antispam-1.ensmp.fr) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joLqk-0007js-9l for pgsql-hackers@postgresql.org; Thu, 25 Jun 2020 06:59:07 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id 9FC8355EE6; Thu, 25 Jun 2020 08:59:04 +0200 (CEST) Received: from petersbourg.cri.ensmp.fr (sfr-16.cri.mines-paristech.fr [77.158.180.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id 8961F2C0286; Thu, 25 Jun 2020 08:59:04 +0200 (CEST) Date: Thu, 25 Jun 2020 08:58:58 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Peter Eisentraut cc: pgsql-hackers Subject: Re: some more pg_dump refactoring In-Reply-To: <6594334b-40fd-14f1-6bc5-877afa3feed5@2ndquadrant.com> Message-ID: References: <6594334b-40fd-14f1-6bc5-877afa3feed5@2ndquadrant.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-237583973-1593068344=:2939276" X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrudekkedguddugecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffujgfkfhgfgggtsehmtderredtreejnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecuggftrfgrthhtvghrnhepvdehgfetueelfeegkeekffelgeefvedtgfejheevgfehteekhefhjeejueehtedunecukfhppeejjedrudehkedrudektddrvdegtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-237583973-1593068344=:2939276 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Hallo Peter, My 0.02 €: Patch applies cleanly, compiles, make check and pg_dump tap tests ok. The refactoring is a definite improvements. You changed the query strings to use "\n" instead of " ". I would not have changed that, because it departs from the style around, and I do not think it improves readability at the C code level. I tried to check manually and randomly that the same query is built for the same version, although my check may have been partial, especially on the aggregate query which does not comment about what is changed between versions, and my eyes are not very good at diffing. I've notice that some attributes are given systematic replacements (eg proparallel), removing the need to test for presence afterwards. This looks fine to me. However, on version < 8.4, ISTM that funcargs and funciargs are always added: is this voluntary?. Would it make sense to accumulate in the other direction, older to newer, so that new attributes are added at the end of the select? Should array_to_string be pg_catalog.array_to_string? All other calls seem to have an explicit schema. I'm fine with inlining most PQfnumber calls. I do not have old versions at hand for testing. > Here is a patch to reorganize dumpFunc() and dumpAgg() in pg_dump, similar to > daa9fe8a5264a3f192efa5ddee8fb011ad9da365. Instead of repeating the almost > same large query in each version branch, use one > query and add a few columns to the SELECT list depending on the > version. This saves a lot of duplication. > > I have tested this with various old versions of PostgreSQL I had available, > but a bit more random testing with old versions would be welcome. -- Fabien. --2056645051-237583973-1593068344=:2939276--