Re: alter check constraint enforceability

From: Cédric Villemain <cedric(dot)villemain(at)data-bene(dot)io>
To: jian he <jian(dot)universality(at)gmail(dot)com>, Amul Sul <sulamul(at)gmail(dot)com>
Cc: Robert Treat <rob(at)xzilla(dot)net>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter check constraint enforceability
Date: 2026-02-09 09:55:00
Message-ID: 71bcefe6-f17f-4a88-b699-f348f9fa7224@data-bene.io
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mon, Dec 15, 2025 at 7:49 PM Amul Sul <sulamul(at)gmail(dot)com> wrote:
>>
>>> v5-0002: alter check constraint enforceability
>>>
>> The patch also looks good, but I have a minor comment for the test --
>> you created the check_constraint_status view, which is not dropped, it
>> should be dropped at the end. Also, instead of a view, I think you
>> could use the \set psql-meta-command; for example, see the
>> init_range_parted or show_data tests in update.sql
>>
>> Also, run pgindent on both patches.
>>
>
> i have tried using \set, but it seems to require the query within a single line.
> since the view check_constraint_status definition is quite longer, \set would
> make it less readable, so I choose to use view.
>
> previously I use
> + newcon = (NewConstraint *) palloc0(sizeof(NewConstraint));
> now use
> + newcon = palloc0_object(NewConstraint);
>
> v6-0001, v6-0002 both indented properly via pgindent, also polished the commit
> messages.

I have some questions/comments (no change on status, I didn't test)

- FK are constraint triggers, does it makes sense to align
"ATExecAlterFKConstrEnforceability" renaming with other functions like
"AlterConstrTriggerDeferrability" ?

- I also wonder if it makes sense to manage NOT NULL together with
CHECK, like in ATAddCheckNNConstraint.... ?

--
Cédric Villemain +33 6 20 30 22 52
https://www.Data-Bene.io
PostgreSQL Support, Expertise, Training, R&D

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-02-09 10:02:09 Re: Row pattern recognition
Previous Message Japin Li 2026-02-09 09:36:19 Re: Propagate XLogFindNextRecord error to callers