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 1vELGS-00AX71-96 for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Oct 2025 05:31:59 +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 1vELGP-0067kw-HE for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Oct 2025 05:31:56 +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 1vELGP-0067ko-4I for pgsql-bugs@lists.postgresql.org; Thu, 30 Oct 2025 05:31:56 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vELGL-0050lJ-1v for pgsql-bugs@lists.postgresql.org; Thu, 30 Oct 2025 05:31:55 +0000 Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-4e88cacc5d9so5691031cf.0 for ; Wed, 29 Oct 2025 22:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761802311; x=1762407111; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vj7oTxDPpbuv0UcEPQAUONYstk1Q2hnP5hBhb2sm2o4=; b=RtKMIzF+9gYFhZZSKm6gPaI8sQr5LYq8GcSbCh34jFyRmuIIzVtc53wkVfa1ShBX8C KFqC3WQu/VOrE2xwuE094LrjbtFiNl1/onqW4K9K8WdvF+Lx8+yzZ5MbMeMi5FFFJdF/ Y8bTdruMloDWIgHV2mDxugsb4rUGiV+0/zUAv5SUYQoNai3/OqUR36OgTqv1miDO4J8D 63lhh/sLm/y/GaggR0EKGi+o04QgbZ0Sz3UYVllU8HloEc+vyjo1819mopz44UyT0ooW 59wlmcSIWRpr8sVID8NJV7bkESNzRR5c38xRIsMeymx+t8bIhj37SD4VWCJ9hcg0lvet 6dvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761802311; x=1762407111; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vj7oTxDPpbuv0UcEPQAUONYstk1Q2hnP5hBhb2sm2o4=; b=Np7qcllX3dfXOxeFxYviKAEVodrb+3rKl2MAic9QbfmDKmFhMn2ovmh/7M9qttSdfY mIjBS+xYHjX5cGSnr8so/rhdfUUlB/kJpaQxLRp/LtgX9PjhjnJV7Z8bJ+Xdv66IiUma cZSr1iAPZIx2hf9mGcSwFSqPwGAsxZgvEeLHDjVgv0kulcpMOrsUWHvXDCXh5hUma5wV 5Mr6zQW0kKklcGhwO+99B+aIJsmBo8Hn+wLUy02QG5kuHPh7fTOZvXghwINjqr9w1jnF ivTxXCR4sBlXyDYC3bLqATVPRJ3/DfEmzyYqpcV7VHMKFzFaBE2FhfDq3IgcR6Rsb9GH hpjQ== X-Forwarded-Encrypted: i=1; AJvYcCX5NYEYwnE7KDeZRQHcyGwHOPE9gXF6Urtrf0sEMGn4cgzKXZu07JQ531kow17+8BVU70qvui5Mr3pF@lists.postgresql.org X-Gm-Message-State: AOJu0Yw4n1OBg0Zdif21Uif5JnUWhv5xnb74dOa3+J4Q1U0Nqh2ZQL0+ hEVKV/0Yg4LGe7O5R3ABLWWBXGj1OYjk+UQBY5YNyf8L1AOzdSnWEJ6h2iqXkW+lsS+oqZS6gFY RoHFNsYEBK0UZzY1QOulq2XQUSrQ2njY= X-Gm-Gg: ASbGncsv8X+inaAMMtb5HfMJWCr0bXRx8/gini+hGcTAlKCvdm9YG9+Ji76ZwtD9cq9 pzNrtcC9NK3evXICrcCGi8U7VoP35rQc3IEX/ZlOUNtjp3RPHcYncWO+ykmq6WL32eePi5pnSKI 0Dh7NU2RRgavAR+NgSW5bb/4eO1i+Xb2Rul1wAB6qJIBuduKkdB223/2/zUPtO/bODjeAEhpYiS 1fuCB/rvXyS8W0ShDwvchHBRQByaQxjX4ebTqtzmS0ZnFIODz5UdezYeRlzbxHGfbH/JcSqnJ+r 8VUnct3G/SF4b9q9uyngEZo8TcI98jC3ow/W X-Google-Smtp-Source: AGHT+IELuh3Ip+CG83FucQJFshLrZWW3wBDU7himyWYj0Vc3rLHUALfonQ0qll/dha3RfFnBIiPYNnCPwWHBBtis7WU= X-Received: by 2002:a05:622a:1195:b0:4ec:76d8:e73f with SMTP id d75a77b69052e-4ed220a2fd0mr20638251cf.10.1761802310756; Wed, 29 Oct 2025 22:31:50 -0700 (PDT) MIME-Version: 1.0 References: <19099-e05dcfa022fe553d@postgresql.org> <2960545.1761800903@sss.pgh.pa.us> In-Reply-To: <2960545.1761800903@sss.pgh.pa.us> From: Kirill Reshke Date: Thu, 30 Oct 2025 10:31:38 +0500 X-Gm-Features: AWmQ_bnvWy-LQ6uayme6NFclbIwL0brtWPg9XYtVhxol4e-tMhGiyvayZpZCnMs Message-ID: Subject: Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error To: Tom Lane Cc: Tender Wang , jian he , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Amit Langote Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 30 Oct 2025 at 10:08, Tom Lane wrote: > > It's surely pretty accidental (and arguably not desirable) > if "DELETE FROM pt WHERE false" doesn't fail the same way. > > Now, I agree that it's not great if you instead get an > internal error like "could not find junk ctid column". > But that smells to me like error checks being applied in > the wrong order rather than something fundamentally wrong. > > I didn't look at the proposed patch yet. > > regards, tom lane I wrote: > But I also wonder if Jian's fix fixed the right thing. Should we > instead fail in the planning phase with a more user-friendly error > message? This will be a regression though, because 'DELETE FROM > file_fdw_table WHERE false' will no longer work... On the second thought, I doubt anyone will get unhappy with 'DELETE FROM file_fdw_table WHERE false' stop working Alexander wrote: > On 86dc9005~1 or with enable_partition_pruning = 'on', EXPLAIN outputs the > query plan and "DELETE FROM pt WHERE false;" completes with no error. So, behaviour was wrong both before and after 86dc9005, just in different ways. On head, we get an error about junk columns, because without partition pruning, we derive the result relation as 'pt', not its partition 'p1', which is correct I believe. But with 'p1' as result relation, we (correctly) error out in ExecInitModifyTable while with 'pt' we don't. So, error checks are applied, order is not wrong, but rather checks are not full enough? I mean, we I believe we need to execute CheckValidResultRel against all partitions in ExecInitModifyTable, at least when no partition pruning has been performed -- Best regards, Kirill Reshke