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 1prfCB-0002L0-PK for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 13:28:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1prfBC-00035T-D4 for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 13:27:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prfBB-00035J-VA for pgsql-hackers@lists.postgresql.org; Wed, 26 Apr 2023 13:27:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1prfB5-00206J-P7 for pgsql-hackers@postgresql.org; Wed, 26 Apr 2023 13:27: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 33QDR5nk841086; Wed, 26 Apr 2023 09:27:05 -0400 From: Tom Lane To: Peter Eisentraut cc: Jelte Fennema , Andrew Dunstan , "shiy.fnst@fujitsu.com" , Robert Haas , Justin Pryzby , Andres Freund , Noah Misch , Peter Geoghegan , Bruce Momjian , Magnus Hagander , Alvaro Herrera , Stephen Frost , Jesse Zhang , "pgsql-hackers@postgresql.org" Subject: Re: run pgindent on a regular basis / scripted manner In-reply-to: References: <4ac8f263-f1bb-faa5-a307-1fffe00f0e3e@dunslane.net> <0f074818-b01a-799f-3c74-5fb5deab1d23@dunslane.net> <1d66447e-a77b-ca0d-90a0-782800e85383@dunslane.net> <3665234.1682174388@sss.pgh.pa.us> <3711455.1682193493@sss.pgh.pa.us> <3841176.1682262970@sss.pgh.pa.us> <183836.1682345671@sss.p! gh.pa.us> Comments: In-reply-to Peter Eisentraut message dated "Wed, 26 Apr 2023 09:38:40 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <841084.1682515625.1@sss.pgh.pa.us> Date: Wed, 26 Apr 2023 09:27:05 -0400 Message-ID: <841085.1682515625@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 24.04.23 16:14, Tom Lane wrote: >> I certainly don't like its current behavior where adding/changing one >> line can have side-effects on nearby lines. But we have a proposal >> to clean that up, and I'm cautiously optimistic that it'll be better >> in future. Did you have other specific concerns? > I think the worst is how it handles multi-line data structures like > $newnode->command_ok( > [ > 'psql', '-X', > '-v', 'ON_ERROR_STOP=1', > '-c', $upcmds, > '-d', $oldnode->connstr($updb), > ], > "ran version adaptation commands for database $updb"); Yeah, I agree, there is no case where that doesn't suck. I don't mind it imposing specific placements of brackets and so on --- that's very analogous to what pgindent will do. But it likes to re-flow comma-separated lists, and generally manages to make a complete logical hash of them when it does, as in your other example: > $node->command_fails_like( > [ > 'pg_basebackup', '-D', > "$tempdir/backup", '--compress', > $cft->[0] > ], > qr/$cfail/, > 'client ' . $cft->[2]); Can we fix it to preserve the programmer's choices of line breaks in comma-separated lists? regards, tom lane