Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-09-23 Thread jian he
hi. please check the attached latest version. I did some minor cosmetic changes. similar to commit 16a0039, we can just use ShareUpdateExclusiveLock to validate existing not-valid not null constraints for the below issue (should the last UPDATE fail or not), I have already created a thread at [1

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-18 Thread Kirill Reshke
On Mon, 18 Aug 2025 at 09:09, jian he wrote: > CREATE DOMAIN use ColConstraintElem. > that's why we do not support syntax: > ``create domain t1 as int not null not valid;`` > > we also do not support column constraints NOT NULL NOT VALID. > Like > ``create table t(a int not null not valid);`` > w

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-17 Thread jian he
On Thu, Aug 14, 2025 at 5:02 PM Kirill Reshke wrote: > > I have few observations. > One is whether we should now support CREATE DOMAIN ... NOT NULL NOT > VALID syntax? This could be a separate patch though. > in gram.y: CreateDomainStmt: CREATE DOMAIN_P any_name opt_as Typename ColQu

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-14 Thread Álvaro Herrera
On 2025-Aug-14, Kirill Reshke wrote: > reshke=# create domain dd as int; > CREATE DOMAIN > reshke=# create table dt(i int, c dd); > CREATE TABLE > reshke=# insert into dt values(1,null); > INSERT 0 1 > reshke=# alter domain dd add constraint c not null not valid ; > ALTER DOMAIN > reshke=# update

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-14 Thread Kirill Reshke
On Thu, 14 Aug 2025 at 07:47, jian he wrote: > > hi. > rebase and minor cosmetic change. Hi! It appears satisfactory to me. I have few observations. One is whether we should now support CREATE DOMAIN ... NOT NULL NOT VALID syntax? This could be a separate patch though. Second observation is just

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-08-13 Thread jian he
hi. rebase and minor cosmetic change. From b87caa1b2f78d3f1e94e1055219c97e038d2fe61 Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 14 Aug 2025 10:40:49 +0800 Subject: [PATCH v3 1/1] ALTER DOMAIN ADD NOT NULL NOT VALID We have NOT NULL NO VALID for table constraints, we can make domain have NOT

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-05-28 Thread jian he
On Thu, May 22, 2025 at 10:08 PM Quan Zongliang wrote: > > It makes sense to support the "NOT NULL NOT VALID" option. > > The two if statements in the AlterDomainNotNull() should be adjusted. > > if (typTup->typnotnull == notNull && !notNull) > ==> > if (!notNull && !typTup->typnotnull) > > > if (

Re: ALTER DOMAIN ADD NOT NULL NOT VALID

2025-05-22 Thread Quan Zongliang
On 2025/5/21 18:44, jian he wrote: hi. attached patch is for $subject implementation per https://www.postgresql.org/docs/current/sql-alterdomain.html """ Although ALTER DOMAIN ADD CONSTRAINT attempts to verify that existing stored data satisfies the new constraint, this check is not bulletpr