Re: NOT ENFORCED constraint feature

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Amul Sul <sulamul(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Joel Jacobson <joel(at)compiler(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: NOT ENFORCED constraint feature
Date: 2024-12-04 08:10:20
Message-ID: CACJufxEG6_Ru25w0sWw5=amt7BRihjt406=iyEseHspn0JU7fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

i just only apply v5-0001 for now.

create table t(a int);
alter table t ADD CONSTRAINT cc CHECK (a > 0);
alter table t alter CONSTRAINT cc NOT ENFORCED;
alter table t alter CONSTRAINT cc ENFORCED;

the last two queries will fail, which means
ALTER CONSTRAINT constraint_name [ DEFERRABLE | NOT DEFERRABLE ] [
INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ ENFORCED | NOT ENFORCED ]
in doc/src/sgml/ref/alter_table.sgml is not correct?
also no code change in ATExecAlterConstraint.

errmsg("cannot validated NOT ENFORCED constraint")));
should be
errmsg("cannot validate NOT ENFORCED constraint")));
?

typedef struct ConstrCheck
{
char *ccname;
char *ccbin; /* nodeToString representation of expr */
bool ccenforced;
bool ccvalid;
bool ccnoinherit; /* this is a non-inheritable constraint */
} ConstrCheck

ConstraintImpliedByRelConstraint,
get_relation_constraints
need skip notenforced check constraint?

put domain related tests from constraints.sql to domain.sql would be better.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Davydov 2024-12-04 08:13:14 Improve DDL related functionality in table AM
Previous Message postgresql_contributors 2024-12-04 08:07:15 Guidance Needed for Testing PostgreSQL Patch (CF-5044)