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 1vH9QJ-00FMcb-He for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Nov 2025 23:29:47 +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 1vH9QH-00AuKG-M8 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Nov 2025 23:29:45 +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 1vH9QH-00AuK8-7N for pgsql-hackers@lists.postgresql.org; Thu, 06 Nov 2025 23:29:45 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vH9QD-006OW5-2z for pgsql-hackers@postgresql.org; Thu, 06 Nov 2025 23:29:44 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-7869dee42cdso2152907b3.1 for ; Thu, 06 Nov 2025 15:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xzilla-net.20230601.gappssmtp.com; s=20230601; t=1762471780; x=1763076580; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uXUCSnRdzRU60jJqrMFYU8b6mqiDqd/qkjoZSpXa/ac=; b=TSXaTwjV4Y8KV8BUXiyvx7qyTIpo0DzNEWopY+aZZbOJR6rp8cIznzCuAKGj90F6tb 1pY+AVW0QHdgFVqdNUTO55a1POMkfL7z1A2vUoRlCWEpnz9f+ndVvsLAcauuQbZaCMQp tZDeTpoU5vRSZKCh/xN/KthjTLdojjZhguc6uHL4o+xKpawTQr7EqhSVnzvqnKwgKcjj jinvSDB7Xp3C86A3u7i5gnYa0brOGz/iEjud6bGq4OdGRcv54CVAe3Lk1Fkbtetyryn9 nko/LpZ6wH7LIMJ3QpUI9dldByXhlhKWGEsnzbLBYhJG5IUFrCbDBqwVPPwq1X/la3Wh oK+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762471780; x=1763076580; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uXUCSnRdzRU60jJqrMFYU8b6mqiDqd/qkjoZSpXa/ac=; b=rvgaZYDawBoT9LRteGBbhiRy1mWUAyZVpWQ6laUGO9fGx/rOIOaeURb4zKuxUEsum5 J2574JvXBaHDJVIkn3qsAHmvfDVXHGrp7kDm/LLcM39MYOeY4p8FqwE9Nnr0LHO8NOs/ rDFI0xyFD+6lA+RfbMO/gkIj+RVDghR/PFAgw+IDCfLVByw83uMPLRTyjLG9W8SrMFD5 QHctCf7xSyL8P2Dk9sGNGkK6Olk1DlAqvJsqVqLsqj+f4WTBAs7el6lvKrSATW02LgNZ BjyfaxYdd60b4w8lBpnC4l968a38SBw65XdPlV5DuzxWVR05LGKSDEC4SFc7NKvC7CU/ Az/g== X-Forwarded-Encrypted: i=1; AJvYcCU9eI1Q+VKFRPmnoBcq5TBfrFMkVhE7H94vXziG3Wxxyrnqvb+W31Y09+JrE/JVWZmDw9tIJHORiT0Jrlhg@postgresql.org X-Gm-Message-State: AOJu0Yxc7ItQMzceiRYqo5RlSXWH+uNLqSWuS/NRS4zA6LNPM7cZbeQC K/ZORxPWjvPTwRcXThN1uYYJ5dCeF/dd5u8UOPpjAYjSB1rAap9FpKaWFXphBivZJXRR9PsEXPQ t8kgiwfG8yhgrsfI5u0PELgm7Qy+7qaZrVNWhsEsbMg== X-Gm-Gg: ASbGncucNe28UMA2BV0fnwQs6PaqwuQtaBkDufVW2q3Ig6ikmo6YNPD9cYfUXuAbuTG LImRpfaxdDDTknW08HhNNzKzf4ksRWQS6lJ0LKH9u1Fp2TUW3XbpTsxS1hrqIhSFzRd5u55gvtq WslJUygd75pwSgJQ7CRC4MTaa37taLudsLhE6CNs3QhLO8KyEJ+64brwT1uCKSXbAz/Va+5p3Xt tJWyh7HSeCO1PFNzjMRuVOCgd4+z2w65cabnEEYTSkN92a8BQoj18BhtmFOBgqRKEuoB90= X-Google-Smtp-Source: AGHT+IESOq1PSZqqD2iGBS8mDOqAadvnkCFH6eV2k0Tn+EeegwCvnVqunf3nlDx+TwRAuo+ZOEocQgF0qlZIcGpFGj4= X-Received: by 2002:a05:690e:1401:b0:63f:b5ea:935a with SMTP id 956f58d0204a3-640b54ac87bmr3917727d50.29.1762471779892; Thu, 06 Nov 2025 15:29:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Treat Date: Thu, 6 Nov 2025 18:29:28 -0500 X-Gm-Features: AWmQ_blvpS6upZFySVWLwF8RS1Lj_rd_pGhgHswoYaXcpK9SnmYSkA_FadeWdhM Message-ID: Subject: Re: alter check constraint enforceability To: Kirill Reshke Cc: jian he , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Aug 11, 2025 at 10:00=E2=80=AFAM Kirill Reshke wrote: > On Mon, 11 Aug 2025 at 14:53, jian he wrote= : > > On Thu, Aug 7, 2025 at 7:35=E2=80=AFAM Robert Treat wr= ote: > > > > > > + if (rel->rd_rel->relkind =3D=3D RELKIND_RELATION && > > > + cmdcon->is_enforced && > > > + !currcon->conenforced) > > > > > > i think I have convinced myself that this is correct, but maybe I wil= l > > > ask you if you had any concerns that this needed to also consider > > > RELKIND_PARTITIONED_TABLE as well? > > > > > > > ATExecAlterCheckConstrEnforceability itself will be recursive to all > > the children. > > AlterConstrUpdateConstraintEntry is responsible for changing the catalo= g state. > > except the changing the catalog state, if we change the check > > constraint from NOT ENFORCED > > to ENFORCED, we also need to verify it in phase 3. > > that's the purpose of > > > + if (rel->rd_rel->relkind =3D=3D RELKIND_RELATION && > > > + cmdcon->is_enforced && > > > + !currcon->conenforced) > > > > partitioned tables don't have storage, phase3 table scan to verify > > check constraint on partitioned table > > don't have effect. > > > > also partitioned table check constraint (name, definition > > (pg_constraint.conbin) must match with partition > > otherwise partition can be attached to the partitioned table. > > so here you don't need to consider RELKIND_PARTITIONED_TABLE. > > > Hi! > I looked at v3. > > Should we rename `ATExecAlterConstrEnforceability` to > `ATExecAlterFKConstrEnforceability `? > +1 Robert Treat https://xzilla.net