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 1whl6u-000P5S-2k for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Jul 2026 09:32:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whl6s-00CEXE-1O for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Jul 2026 09:31:59 +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 1whl6s-00CEX3-0a for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 09:31:58 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whl6q-00000000Rgo-0xxq for pgsql-bugs@lists.postgresql.org; Thu, 09 Jul 2026 09:31:58 +0000 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-495c63c41ceso929356b6e.2 for ; Thu, 09 Jul 2026 02:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783589515; cv=none; d=google.com; s=arc-20260327; b=NULwzZsfUStMbIXnk/n3jaslSiuJEmjfIMKBVVIVN7aZOsf8ZtBUFSgx639Lgrwms0 k/LeyqIBDBp6I6/DcP1pj/f200JSyMWSss3WjKrFYddvOBrHhUbdfMYnJJ3qN3O9W7QU 4AGA7ASHazafloq2jT0nweB0k6ZHNtYOoRvqDybZzhctgytr45ZbXD135U2jnTXFemRz ofcUcBJmAYLxESdb+AxEE+8bKCYXWgnIlrZjB8tWDOtix1I78h4Nzi5ze68Js+F783di /23nFCYtgYZxLNEk4V36vVs3huv3wCN8pQ9NfspTQmuyykMK7XDxSHvpovJLqAXqTExl iaiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=l7Jnquhnwn4affbgoqah8O9Su0Tcncsd603gK1rDJkg=; fh=/gQe77b11iMZdcPj/nJr/Ghqi6rQp5FPrPbdO93bmOA=; b=F+5yBx14JvvEj3R9lfi0gKUxl149GOJhWpQSQye2TxNSXPUcCtr/Lj2AXZk4TL587D b0DMxlPP3e9/AMKV8VW5HQX0JqCqDeKtCg0ehWZsq9UpTZkufLqcyxJPRebz/rSdsaeL 26QcXzWrUVqh1PqrBUnS1ANxuESOgfu5duQPAJuIAbEwxexZKmQdK+I/wVnYxe7jkDF6 EQcLVxV7erVgcTXVVdF3njiFsLqFNWLVt9v3GMx48uUN+cAZ7HmM0V4VMn2rjK2qooE0 a6+3PB3SzXYap3SId/80Tikgk6ZIFtUnJQwNoSnOL68QtCdbw1gNnyWBYpYS7Zocjlhq pXGQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783589515; x=1784194315; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:to:subject:message-id:date :from:in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to:content-type; bh=l7Jnquhnwn4affbgoqah8O9Su0Tcncsd603gK1rDJkg=; b=L7LITZBJl9V8uz8K7dgMdlBFcJvVuapnhNjITAUn4/hhH1OaNqkSCTMEfARVvE6EU3 s2jOd0plqogfgO+1nU83vuK1x5VeiMc9jAknWwsw1JSlH0YGxDY1A/rDhep5nHgwRIym 1pJoNWGMm/Ox2tIo5YGqY7PQZskBB2bXIAIWafYyhP2/+GAHrw3tV6+GAyQ+XoV+uU2B GgvRfXfuWcbYAoIvhsxMxB0hfi670tTH7WW8ZCZS3LwrwR8fzj4/z0XkkoVi4ZHk44RA NCjOEqGHicDIqbD+fnsNt4r7Kky9nCepobhr5t+wmJECIhwGCJHtKSt2pxancENI72mN dZEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783589515; x=1784194315; h=content-transfer-encoding:content-type: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:content-type; bh=l7Jnquhnwn4affbgoqah8O9Su0Tcncsd603gK1rDJkg=; b=pNZQ0T+BX0SEf+MSmV1I5sPY1F9mNgISNuzctpXXW/5R0+42AsH8uy/0xPfRD+bF4u 71NerOlzwNpUTtrvjlgytrI5AvNu+RLfWfz3jAvtLV0v7LtJsJ6ia8l6vvBSlkjSLrhN AlOOhXEo4g2S4YwfQtlo92bZOcvQ8xWeB1YEYaNnjGKHxFmGDYgoDlzeD/KvxMKws3qt 4/qdUoNY4bVu9BEiJAwMRhMhUDnShEMGmlq5rfdjYdzrtqlZZz5khGJogEc/ILbKzDw4 j2XEhTyyLHm8XQqj1ieNh+6se4QgYB10PdI9MVeRaVc5S08/0C0AgvStOQ/Aw5oaGr5Z XtiA== X-Gm-Message-State: AOJu0Ywut46jZoC2fuUOfjzlQYprDVqq3kYF+sZwvJX+nFLemEb/1db7 wBV7HY2DljLRBpBHVfN/PNRZ334ixw/WTbAjprDh3VDP53ykFuRppQNxhzuK15ipCjDygAjKups 4Q8nhWjWYSadIoKY+ETkgIkRsRtbAW7ByARm11b4= X-Gm-Gg: AfdE7clyNoVVsw4kdm9n6N3Fer0m2M9J1vogbzcpowPrurtratyIQbKOC1mvXt8cnVu l9bh6it5QmAwhlM7+qmP0OMIoJsLUw13idK0JVATeJqTjaWd3hBQtWdYhsZTD5mhFIHGHl6Gjso GC8hDzR0vtRfzgNpYjQMtoIhKX5Tpdtb1+61vter5eDTCCCH+v0ZH24RmmFY0s+A0J0rCTTgYzk UoYRxk6WSNj5ArL8ffAELHIlcaoFrv6y8UVsJVeKqBFvtUPmqsKMSDaiQOe7WDsxd+L/3DE2wH/ QWJO80s= X-Received: by 2002:a05:6808:14c3:b0:495:fed2:1db3 with SMTP id 5614622812f47-4a201bf128emr6092305b6e.5.1783589514688; Thu, 09 Jul 2026 02:31:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Vismay Tiwari Date: Thu, 9 Jul 2026 15:01:43 +0530 X-Gm-Features: AUfX_mwTnecjdG83yQlaz1SxW2WPvx7fvUvJehLs0lxsHb9fTNrQH2uGu8ZGbXo Message-ID: Subject: Re: BUG #19507: Auto-named partition table constraint conflicts To: pgsql-bugs@lists.postgresql.org 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 Hi Marko, Apologies for the noise =E2=80=94 I replied off the original report and onl= y afterward noticed you'd already posted a complete patch back on the 4th. Please disregard the patch I sent; yours is clearly further along (backpatch-tested and already in review). Happy to review or test it if a second pair of eyes would help. Sorry for the overlap. Regards, Vismay On Thu, Jul 9, 2026 at 2:45=E2=80=AFPM Vismay Tiwari w= rote: > > Hi, > > Thanks for the report, Marko. I could reproduce both cases on current mas= ter. > > The root of it is that when the constraint name is auto-generated for the > partitioned parent, ChooseConstraintName only checks for a clash within t= he > parent's own schema. So a partition sitting in another schema that alread= y has > a constraint by that name isn't noticed, and the name then collides once = it's > propagated down. A same-schema partition doesn't trip this, because the > namespace-scoped lookup already sees that one and picks a non-conflicting= name; > that makes it specific to partitions in other schemas. > > The attached patch gathers the constraint names already present on the > descendants and passes them to ChooseConstraintName as names to avoid, so= the > generated name comes out unique across the whole hierarchy. I deliberatel= y kept > those names out of the checknames/nnnames lists, since those also drive t= he > duplicate check for explicitly-named constraints, and folding them in wou= ld > break legitimate merges of same-named inherited constraints. It's guarded= on > relhassubclass, so there's no extra work for tables without children. > > I added a regression test in constraints.sql covering both the SET NOT NU= LL and > ADD CHECK cases; make check passes. > > One thing I didn't chase down: foreign-key names go through a similar > auto-naming path, so they may have the same issue. I haven't tested that,= so > I'm flagging it in case it's worth a look. > > Regards, > Vismay Tiwari