Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2025-03-10 Thread Alvaro Herrera
Hello, On 2025-Jan-15, jian he wrote: > we cannot error out AlterDomainAddConstraint for cases like ALTER > DOMAIN ADD CHECK NO INHERIT. > because "NO INHERIT" is actually a separate Constraint Node, and > AlterDomainAddConstraint > can only handle one Constraint node. I had forgotten this threa

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2025-01-16 Thread Peter Eisentraut
I have committed the part of this patch that removes the switch statement in AlterDomainAddConstraint(). That one is dead code. I'll study the other discussion a bit more. I agree the current code isn't satisfactory.

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2025-01-14 Thread jian he
On Wed, Jan 15, 2025 at 12:37 AM Alvaro Herrera wrote: > > Hello, > > On 2024-Dec-09, jian he wrote: > > > ALTER DOMAIN ADD CONSTRAINT syntax more simple than CREATE DOMAIN. > > Your proposed patch makes the code simpler, yes, but I think it also > makes the error messages worse. I don't think th

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2025-01-14 Thread Alvaro Herrera
Hello, On 2024-Dec-09, jian he wrote: > ALTER DOMAIN ADD CONSTRAINT syntax more simple than CREATE DOMAIN. Your proposed patch makes the code simpler, yes, but I think it also makes the error messages worse. I don't think that's an improvement from the user point of view. -- Álvaro Herrera

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2024-12-09 Thread jian he
hi. ALTER DOMAIN ADD CONSTRAINT syntax more simple than CREATE DOMAIN. So in gram.y, I changed DomainConstraintElem to the following: DomainConstraintElem: CHECK '(' a_expr ')' { Constraint *n = makeNode(Constraint); n->contype =

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2024-12-06 Thread jian he
On Fri, Dec 6, 2024 at 10:48 PM Alvaro Herrera wrote: > > On 2024-Dec-06, jian he wrote: > > > basically processCASbits > > from > > processCASbits($3, @3, "NOT NULL") > > processCASbits($5, @5, "CHECK") > > to > > processCASbits($3, @3, "DOMAIN with NOT NULL") > > processCASbits($5, @5, "DOMAIN w

Re: refactor AlterDomainAddConstraint (alter domain add constraint)

2024-12-06 Thread Alvaro Herrera
On 2024-Dec-06, jian he wrote: > basically processCASbits > from > processCASbits($3, @3, "NOT NULL") > processCASbits($5, @5, "CHECK") > to > processCASbits($3, @3, "DOMAIN with NOT NULL") > processCASbits($5, @5, "DOMAIN with CHECK") This doesn't actually work from a translation point of view,

refactor AlterDomainAddConstraint (alter domain add constraint)

2024-12-06 Thread jian he
hi. attached patch refactor AlterDomainAddConstraint * change the error message: alter domain d_int add constraint nn not null no inherit; from ERROR: NOT NULL constraints cannot be marked NO INHERIT to ERROR: DOMAIN with NOT NULL constraints cannot be marked NO INHERIT basically processCASbits