| From: | Robert Treat <rob(at)xzilla(dot)net> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: alter check constraint enforceability |
| Date: | 2025-11-06 23:29:28 |
| Message-ID: | CAJSLCQ0rgBK5cgXZzZSHnyBWi95Ngkky8+c1Jf_S0z_x4x6Zrw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Aug 11, 2025 at 10:00 AM Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
> On Mon, 11 Aug 2025 at 14:53, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> > On Thu, Aug 7, 2025 at 7:35 AM Robert Treat <rob(at)xzilla(dot)net> wrote:
> > >
> > > + if (rel->rd_rel->relkind == RELKIND_RELATION &&
> > > + cmdcon->is_enforced &&
> > > + !currcon->conenforced)
> > >
> > > i think I have convinced myself that this is correct, but maybe I will
> > > ask you if you had any concerns that this needed to also consider
> > > RELKIND_PARTITIONED_TABLE as well?
> > >
> >
> > ATExecAlterCheckConstrEnforceability itself will be recursive to all
> > the children.
> > AlterConstrUpdateConstraintEntry is responsible for changing the catalog state.
> > except the changing the catalog state, if we change the check
> > constraint from NOT ENFORCED
> > to ENFORCED, we also need to verify it in phase 3.
> > that's the purpose of
> > > + if (rel->rd_rel->relkind == RELKIND_RELATION &&
> > > + cmdcon->is_enforced &&
> > > + !currcon->conenforced)
> >
> > partitioned tables don't have storage, phase3 table scan to verify
> > check constraint on partitioned table
> > don't have effect.
> >
> > also partitioned table check constraint (name, definition
> > (pg_constraint.conbin) must match with partition
> > otherwise partition can be attached to the partitioned table.
> > so here you don't need to consider RELKIND_PARTITIONED_TABLE.
>
>
> Hi!
> I looked at v3.
>
> Should we rename `ATExecAlterConstrEnforceability` to
> `ATExecAlterFKConstrEnforceability `?
>
+1
Robert Treat
https://xzilla.net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2025-11-06 23:49:37 | Re: postgres_fdw: Use COPY to speed up batch inserts |
| Previous Message | Alexey Makhmutov | 2025-11-06 23:17:07 | Re: High CPU consumption in cascade replication with large number of walsenders |