Re: simplifying grammar for ALTER CONSTRAINT .. SET [NO] INHERIT

From: Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: simplifying grammar for ALTER CONSTRAINT .. SET [NO] INHERIT
Date: 2025-03-26 14:23:36
Message-ID: CAF1DzPUkZr9Eug0Pu_GTmfWZDSWeL3HAOPH9-4CM_261JY8U0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 25, 2025 at 9:32 PM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> With commit f4e53e10b6ce we introduced a way to flip the NO INHERIT bit
> on not-null constraints. However, because of the way the grammar
> dealt with ALTER CONSTRAINT, we were too blind to see a way to implement
> it using the existing production. It turns out that we can remove it,
> so the commands would be
>
> ALTER TABLE tab ALTER CONSTRAINT constr INHERIT
> ALTER TABLE tab ALTER CONSTRAINT constr NO INHERIT
>
> i.e. the word SET is no longer needed.
>
> Do people find this better?
>

Yes, I agree. As Peter said, it is now inline with other commands.

I have reviewed the patch and it looks good to me.

Since we are removing the SET keyword, how about removing that from the
below comment as well.

/*
* Propagate the change to children. For SET NO INHERIT, we don't
* recursively affect children, just the immediate level.
*/

This is the comment from ATExecAlterConstrInheritability().

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Ratundalov 2025-03-26 14:27:05 Remote partitionwise doesn't work for varchar join keys
Previous Message Maksim.Melnikov 2025-03-26 14:17:17 sync_standbys_defined read/write race on startup