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.96) (envelope-from ) id 1wFp9Y-005arf-21 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 08:11:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFp9X-000dVK-1c for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 08:11:15 +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.96) (envelope-from ) id 1wFp9X-000dVC-0e for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 08:11:15 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFp9S-00000002cEW-14aw for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 08:11:14 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4891cd41959so44576065e9.3 for ; Thu, 23 Apr 2026 01:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776931868; x=1777536668; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=sk/FybrBzYwXotoXLkHbXC1433nLRizwvkCcZE2ObhU=; b=AKmMkmmokZJFUV548DVhKgfgTESNkrSqtR09IHbIR6l0Pv1pzBR9JhrzTPqXSCUF5k FC3xA6YTyBlQe+3bYRflhdL6Agq97xuAKJjL4v4Pt3pM0SRgBK+aDtz/ymWTtZ9vzkhL wAWk3xEDzWS63BBOAC25ri1VAaI6P7QYMo+JTOm4FC7gvgVpbYHJgvxjJcIz6gPHZqAZ sx4Vajpiw/GIYMdIF+AUSK09kKHkScOW5YHpDb3Klg1Pe8r0/I0kfFrNFQwzUg2gqvFi 181mFNsd5gBCFDrjTs/1VTqnIP4xE/mKowQsjsZWFVTQxCTgFyVfqms6DUoneilXm4Pi pPsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776931868; x=1777536668; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sk/FybrBzYwXotoXLkHbXC1433nLRizwvkCcZE2ObhU=; b=S1qtTs2AdMBG6T2CWpSdDPtQm9/cah8SS9GxANzoMX2A5gL9vtnnUqpgdtEjoqBm7x 3SQUN8/XW4PRcOTk91cPesKn+WO2+vilo9z01+N+VGBC5b3h6bkdxYJb1aujmpoogZOH a9r6ZBl002hBcKSA3CXGMh5UhddjUMyxLV6fJHydP/5ymHlPZPA4oxTPV1X51J7B4Goo 7Z8lpxDkSbQOU4kbIK8lB3euq+92Ra4ZuMNT3gwoS1fgEsn59iDjM7dUsh/M5yspHcNq hI9RW8Z0BgShqjTONIEvOVPdP5+1zKl5R4jc6MaI2/I6YdTJ6QAW7nnZNj0a3ANXEGlk 8LZg== X-Forwarded-Encrypted: i=1; AFNElJ8L1aZnHk4rbGiinA5Lp+F1EyoH9Zw+9AfCOvpq8Wc5yc5x7/YaKNwNaLKl1p9AjbB0Ht3EwXWHGednqdVc@lists.postgresql.org X-Gm-Message-State: AOJu0Yyt6+0hQdy7YyqMKWoFRVKJBMxXpFWFB4Q9Oj//YcRp1Pwzj7tz flT2wwWvIN/pjxE+MFA85/Nghymqkhrp8Kxdr8FFCqxvvxYdiq5HY2iH X-Gm-Gg: AeBDieudNR7mZCfIGLf+74kFyuotRKCmOmSIk/UCTnZJA9ft618qFmOX3Ik3fq/DCJU 436N4JxLbpo0MVMIYX1ckZIDbEklHjSW7ix9ZI8OZe8taHlV/JmizmU21caNf2L2l4XtFfB8z9b Sws9Fc8iM+3BBou++Z4iOmoDoZyZ+l3u6YW7f19PmdVZ0mi/hHv85Gx2r5tk/4E1b/3ciAs93Mu d3wDzwtzoMNCjPBiSvueRQUSU+SQVTrXf421XC3RsyuRbI0yhN7T1vW1RmcXROT5xeDTif5urzG +TukKuBnULCLC+ldngRzt30veaxVFwKNX98Ee+qs8PLMHmQpFbe382aUiybkZmHyayta0w7tgmN DVFSPj6HI4LEvgU21EKHHvsAt1N5OXSMqfSZFy5c0ayy2VyRysv+QsUR5TUu2znC7mg4re2Rp4a POXV2HnfnsVaHlvpKH5xese5TDNLjQsMadHBOoxakMQYglyJ0lYyCiUXgqD2p8TPkB9vwA00Daa iGbUjbpWg== X-Received: by 2002:a05:600c:3f0c:b0:48a:563c:c8e0 with SMTP id 5b1f17b1804b1-48a563cd16bmr136558075e9.1.1776931868183; Thu, 23 Apr 2026 01:11:08 -0700 (PDT) Received: from [192.168.0.86] (84.123.230.95.dyn.user.ono.com. [84.123.230.95]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4411c9f4f03sm21637590f8f.1.2026.04.23.01.11.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Apr 2026 01:11:07 -0700 (PDT) Message-ID: Date: Thu, 23 Apr 2026 10:11:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: The bogus calls in remove_self_join_rel() To: Richard Guo , Pg Hackers References: Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 23/04/2026 04:45, Richard Guo wrote: > I noticed these two calls in remove_self_join_rel(): > > adjust_relid_set(root->all_result_relids, toRemove->relid, toKeep->relid); > adjust_relid_set(root->leaf_result_relids, toRemove->relid, toKeep->relid); > > There's no comment explaining them, and as far as I can tell they do > nothing: adjust_relid_set returns a Relids and does not modify the > input in place. There is a clear history of these calls. When designing SJE, we initially applied it to partitioned tables. Later, we realised complicated issues arise when SJE meets DML, the RETURNING clause, and partitioned tables. So, we reduced the feature for some time. I guess the core code's stability has been proven enough by PG18. We may introduce SJE over partitioned tables in the next release. You can probably remove these calls for now. Just make sure to add assertions to help with developing the partitioned case. -- regards, Andrei Lepikhov, pgEdge