Re: not null constraints, again

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tender Wang <tndrwang@gmail.com>, jian he <jian.universality@gmail.com>, Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-15T21:12:42Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2025-Apr-15, Tom Lane wrote:
>> Looking at the patch itself, it doesn't seem like the got_children
>> flag is accomplishing anything;

> Ah yes, I forgot to set got_children when reading the children list.
> This happens within the loop for columns, so the idea is to obtain that
> list just once instead of once per column.

Ah, got it.  Makes sense as long as you actually avoid the work ;-)

			regards, tom lane



Commits

  1. Suppress "may be used uninitialized" warnings from older compilers.

  2. Elide not-null constraint checks on child tables during PK creation

  3. Remove unnecessary code to handle CONSTR_NOTNULL

  4. Silence compilers about extractNotNullColumn()

  5. Add pg_constraint rows for not-null constraints