Re: not null constraints, again

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: not null constraints, again
Date: 2024-09-20 12:08:28
Message-ID: 202409201208.oktu73fuvffw@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-Sep-20, jian he wrote:

> about set_attnotnull.
>
> we can make set_attnotnull look less recursive.
> instead of calling find_inheritance_children,
> let's just one pass, directly call find_all_inheritors
> overall, I think it would be more intuitive.
>
> please check the attached refactored set_attnotnull.
> regress test passed, i only test regress.

Hmm, what do we gain from doing this change? It's longer in number of
lines of code, and it's not clear to me that it is simpler.

> I am also beginning to wonder if ATExecSetNotNull inside can also call
> find_all_inheritors.

The point of descending levels one by one in ATExecSetNotNull is that we
can stop for any child on which a constraint already exists. We don't
need to scan any children thereof, which saves work.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Use it up, wear it out, make it do, or do without"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-09-20 12:13:29 Re: [PATCH] Support Int64 GUCs
Previous Message Alexander Korotkov 2024-09-20 12:06:27 Re: SQLFunctionCache and generic plans