Re: using index to speedup add not null constraints to a table - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: using index to speedup add not null constraints to a table
Date
Msg-id 202504280840.vmqn6igfmeuh@alvherre.pgsql
Whole thread Raw
In response to Re: using index to speedup add not null constraints to a table  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On 2025-Apr-28, jian he wrote:

> for tests, just found out i can imitate
> src/test/modules/test_misc/t/001_constraint_validation.pl,
> 
> So I created a file:
> src/test/modules/test_misc/t/008_indexscan_validate_notnull.pl
> for TAP tests.

Seems reasonable, didn't look at it in detail.  I think you don't have
any tests where you try to set multiple columns as NOT NULL in a single
ALTER TABLE command; I think this is worth having.  Something like

CREATE TABLE foo (col1 int, col2 int, col3 int);
... create indexes on col1 and col2 ...
alter table foo set col1 not null,
                set col3 not null,
        add constraint bla not null b;
and stuff like that.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"If you have nothing to say, maybe you need just the right tool to help you
not say it."                   (New York Times, about Microsoft PowerPoint)



pgsql-hackers by date:

Previous
From: Nitin Motiani
Date:
Subject: Re: Adding pg_dump flag for parallel export to pipes
Next
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: Fix slot synchronization with two_phase decoding enabled