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 1rdkKf-007HSy-8r for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 05:12:17 +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 1rdkKd-0043nR-6H for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 05:12:15 +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.94.2) (envelope-from ) id 1rdkKc-0043nJ-Rz for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 05:12:15 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rdkKW-000iMM-Js for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 05:12:13 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-608d55ab7b0so967867b3.1 for ; Fri, 23 Feb 2024 21:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1708751529; x=1709356329; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ym2F49Oyuq1OCsHnlOx7eG3cwuGe4x663jALMDWsb2k=; b=amj5qUkfqWxOVWhIas1Ku0cb6deArzsmkimG/Lc4gTYk5CEVymDBgDIlBylWfuLNP+ 7vlzVeEEXawbB4BJeJRoKMbHLfvqSd1PWjXX37A7m15iUdUm1kMbEh9eaZr6Xf0DdGoL xY1DtVsyD0RJqhENV59ErkckXNf1hzgp9/MtE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708751529; x=1709356329; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ym2F49Oyuq1OCsHnlOx7eG3cwuGe4x663jALMDWsb2k=; b=q8K4/hY3ZHCxDa7Gc7ZXnm4+sM09klz2Naq2HQ/VQ7BM9hi2Ml8gsfEKYGOXaU/Y8t vJYGrCwCWWlFHODKVoeZrkvaBt5QiUbgHJfWH7uoBAgceCsM66y4Xfvc0hCD6F4nnPOF PKeI7Jo7mBZX8POGexbqoRSi0OPb8t30xkk0VC+iXgLLKpgv3MyIzHkesbCO/rS0EPjf /OL0rlWlu20vpFZrV5+KKVJfbZ8urO9AkooQ/D5RYBMb4baJWRCB+7k+1tr0adpbc9x+ Sn4oeWEBmqjDBZQYUo9Gy2xpkQ5TwoBGHVDRmDLpKKPM4CNgMIyS2jhG735nzt5KTpMk MlzA== X-Forwarded-Encrypted: i=1; AJvYcCW1KtPr+0pPWTmNcBXe/w6I4dhqjovnzueq81rV9NOFdLbb/A0lkZhfRomwjC6DP2NVAAnzbcGccjckBEbQjU51UbkJ6utf6X8csBCo7qWIjsOa X-Gm-Message-State: AOJu0YwXct0PKHdY8cl9stpnVxxMODkyFG4wPAaRNi00CW0qw1tWaclv lZHxg9W6M52KGxzPR8vn318DMm5Yhqj0PL31ASVyiWDoH+1zB8ZC5ou7eVXm/g== X-Google-Smtp-Source: AGHT+IH+VM4jQAgowKTSpwPnqmLe0dLCJJIFBA0CsRyIm0V1uZXm+dlGeUQLr7dth/y7fI+zh/73Qw== X-Received: by 2002:a81:a085:0:b0:608:2f27:5c0e with SMTP id x127-20020a81a085000000b006082f275c0emr1948953ywg.8.1708751528987; Fri, 23 Feb 2024 21:12:08 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id z127-20020a816585000000b0060755a31c0bsm121696ywb.100.2024.02.23.21.12.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2024 21:12:08 -0800 (PST) Date: Fri, 23 Feb 2024 21:12:05 -0800 From: Noah Misch To: Richard Guo , Andrei Lepikhov , Alexander Korotkov Cc: Alexander Lakhin , "Gregory Stark (as CFM)" , =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= , PostgreSQL Hackers , Tom Lane Subject: Re: Removing unneeded self joins Message-ID: <20240224051205.db@rfd.leadboat.com> References: <4788f781-31bd-9796-d7d6-588a751c8787@gmail.com> <56ee4520-e9d1-d519-54fe-c8bff880ce9b@gmail.com> <5063f378-ca3c-405e-b1e8-1927ea9052e8@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Feb 24, 2024 at 12:36:59AM +0200, Alexander Korotkov wrote: > On Thu, Feb 22, 2024 at 10:51 AM Andrei Lepikhov wrote: > > On 21/2/2024 14:26, Richard Guo wrote: > > > I think the right fix for these issues is to introduce a new element > > > 'sublevels_up' in ReplaceVarnoContext, and enhance replace_varno_walker > > > to 1) recurse into subselects with sublevels_up increased, and 2) > > > perform the replacement only when varlevelsup is equal to sublevels_up. > > This code looks good. No idea how we have lost it before. > > Thanks to Richard for the patch and to Andrei for review. I also find > code looking good. Pushed with minor edits from me. I feel this, commit 466979e, misses a few of our project standards: - The patch makes many non-whitespace changes to existing test queries. This makes it hard to review the consequences of the non-test part of the patch. Did you minimize such edits? Of course, not every such edit is avoidable. - The commit message doesn't convey whether this is refactoring or is a bug fix. This makes it hard to write release notes, among other things. From this mailing list thread, it gather it's a bug fix in 489072ab7a, hence v17-specific. The commit message for 489072ab7a is also silent about that commit's status as refactoring or as a bug fix. - Normally, I could answer the previous question by reading the test case diffs. However, in addition to the first point about non-whitespace changes, the first three join.sql patch hunks just change whitespace. Worse, since they move line breaks, "git diff -w" doesn't filter them out. To what extent are those community standards vs. points of individual committer preference? Please tell me where I'm wrong here.