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 1rdvhQ-008McN-FV for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 17:20:32 +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 1rdvhN-005K61-Kl for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Feb 2024 17:20:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdvhN-005K5s-B9 for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 17:20:29 +0000 Received: from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rdvhL-000i15-DY for pgsql-hackers@lists.postgresql.org; Sat, 24 Feb 2024 17:20:29 +0000 Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-608d542655aso4898497b3.0 for ; Sat, 24 Feb 2024 09:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1708795225; x=1709400025; 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=anO0IZ9CNGg4WjESgqgeZu/U1tFpvQKlEZ/7f8yiVY8=; b=SBVhfpElCxk5OFNZfwiJymh9+bIkUqcavejTRYUyK+9qjv4wAwbsp2GK6MIIa5eAKB bKRLM/f5cMbBbp01RCGcUcJLA1hP4EA5ytr2n84AiHgOdbg2Jeb6kmai2sE94uMfea+l ldsu2FprEtG/WU7LAmaY4bV99yoQocKOr5Zlo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708795225; x=1709400025; 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=anO0IZ9CNGg4WjESgqgeZu/U1tFpvQKlEZ/7f8yiVY8=; b=wByeVP3lJwopf7tJCJfmrbASyi5FtbJZ/JJdEzkTdNmnq55KA99ZrUGRgh5bwVcOHC iVxfKhY66hjG+kBN411DgSQIDP4BophQ+CEjwZK4pD43jaPrYdioY11olKc29lXf/b/u OI4/r1W9TS4zdVGmyZhGiWuMEMwSpywWhwA2UZJQ8ZPDteSL2Vx2CFVtXynyWQlqKfbp 6Ge42iF1pa+eqtKJyH0bhFbzhcMQg7e4Urz9+PQLAeA5+OUh751vpBB4w5+Vdphg1gar yiMopeR44IjLKiWJijKliL5GlWdFdUls+TX4sqW8NhpTnzjKJ8q+IOQTNx2PaXfeT2bA 05zw== X-Forwarded-Encrypted: i=1; AJvYcCWo/8DgU0SDPoVbOLEVRfxEF9xLpGvh/22xM9ptWQIhBnQvtSCkCP7wYJLbJlM6iqLxK3KrmC81AIqJdVjnTjdG07gccAN/IRUYDeChmDu5ewuW X-Gm-Message-State: AOJu0YwF1Zoj4ptAE0Kc3Act8SsnSdTlpKFPH1hpL6F7Ox/dNoWkRL/x dBhWUzho4/3J+3Iitig3D5IRV5HJb2CJcErvvq+Su+AHiAzA7UY9yKv2sMXolw== X-Google-Smtp-Source: AGHT+IGfTma2uYuszFX1GHAFlhbFna7Wv/yN0c6LhEbpWZCXE708CoNmwexoJj+tzurwByQFa7kxIw== X-Received: by 2002:a81:e549:0:b0:608:bc78:94b7 with SMTP id c9-20020a81e549000000b00608bc7894b7mr2121321ywm.49.1708795225538; Sat, 24 Feb 2024 09:20:25 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id d140-20020a814f92000000b0060480a0e282sm355304ywb.60.2024.02.24.09.20.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2024 09:20:25 -0800 (PST) Date: Sat, 24 Feb 2024 09:20:22 -0800 From: Noah Misch To: Alexander Korotkov Cc: Richard Guo , Andrei Lepikhov , 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: <20240224172022.c4@rfd.leadboat.com> References: <56ee4520-e9d1-d519-54fe-c8bff880ce9b@gmail.com> <5063f378-ca3c-405e-b1e8-1927ea9052e8@postgrespro.ru> <20240224051205.db@rfd.leadboat.com> 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 Hello, On Sat, Feb 24, 2024 at 01:02:01PM +0200, Alexander Korotkov wrote: > On Sat, Feb 24, 2024 at 7:12 AM Noah Misch wrote: > > 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. > > I agree that commit 466979e is my individual committer failure. I > should have written a better, more clear commit message and separate > tests refactoring from the bug fix. > > I'm not so sure about 489072ab7a (except it provides a wrong fix). It > has a "Reported-by:" field meaning it's a problem reported by a > particular person. The "Discussion:" points directly to the reported > test case. And commit contains the relevant test case. The commit > message could be more wordy though. Agreed, the first and third points don't apply to 489072ab7a. Thanks to that, one can deduce from its new test case query that it fixes a bug. It sounds like we agree about commit 466979e, so that's good.