From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: cataloguing NOT NULL constraints |
Date: | 2024-02-07 09:44:24 |
Message-ID: | CACJufxGmy-Xncq-NHJ9rHbQJrGu5bZtcyT2v-6-ZbgpE9htMpQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Feb 5, 2024 at 5:51 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2024-Feb-05, Alvaro Herrera wrote:
>
> > Hmm, let me have a look, I can probably get this one fixed today before
> > embarking on a larger fix elsewhere in the same feature.
>
> You know what -- this missing CCI has a much more visible impact, which
> is that the attnotnull marker that a primary key imposes on a partition
> is propagated early. So this regression test no longer fails:
>
> create table cnn2_parted(a int primary key) partition by list (a);
> create table cnn2_part1(a int);
> alter table cnn2_parted attach partition cnn2_part1 for values in (1);
>
> Here, in the existing code the ALTER TABLE ATTACH fails with the error
> message that
> ERROR: primary key column "a" is not marked NOT NULL
> but with the patch, this no longer occurs.
>
> I'm not sure that this behavior change is desirable ... I have vague
> memories of people complaining that this sort of error was not very
> welcome ... but on the other hand it seems now pretty clear that if it
> *is* desirable, then its implementation is no good, because a single
> added CCI breaks it.
>
> I'm leaning towards accepting the behavior change, but I'd like to
> investigate a little bit more first, but what do others think?
>
if you place CommandCounterIncrement inside the `if (recurse)` branch,
then the regression test will be ok.
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 9f516967..25e225c2 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -7719,6 +7719,9 @@ set_attnotnull(List **wqueue, Relation rel,
AttrNumber attnum, bool recurse,
false));
retval |= set_attnotnull(wqueue, childrel, childattno,
recurse, lockmode);
+
+ CommandCounterIncrement();
From | Date | Subject | |
---|---|---|---|
Next Message | just madhu | 2024-02-07 09:47:06 | pgjdbc is not working with PKCS8 certificates with password |
Previous Message | Michael Paquier | 2024-02-07 09:42:21 | Re: Is this a problem in GenericXLogFinish()? |